Assign and print the value of a variable - CSharp Language Basics

CSharp examples for Language Basics:Variable

Description

Assign and print the value of a variable

Demo Code




using System;/*  w ww  .  ja  va  2 s.  co  m*/

class var_values
{
    public static void Main()
    {
        // declare my_variable
        int my_variable = 8, your_variable = 1000;

        // assign a value to my_variable
        my_variable = 5;
        Console.WriteLine("\nmy_variable contains the value {0}", my_variable);
        Console.WriteLine("\nyour_variable contains the value {0}", your_variable);
    }
}

Result


Related Tutorials