Assign and print the value of variables - CSharp Language Basics

CSharp examples for Language Basics:Variable

Description

Assign and print the value of variables

Demo Code

using System;/*w ww .  j  a va2s.co  m*/
class MainClass
{
   public static void Main()
   {
      int first_var;
      int second_var = 200;
      first_var = 5;
      Console.WriteLine("\nfirst_var contains the value {0}", first_var);
      Console.WriteLine("second_var contains the value {0}", second_var);
      first_var = 1010;
      second_var = 2020;
      Console.WriteLine("\nfirst_var contains the value {0}", first_var);
      Console.WriteLine("second_var contains the value {0}", second_var);
   }
}

Result


Related Tutorials