Swap two numbers

using System;

     //C# program to swap two numbers.

class HelloWorld
{

  static void Main ()
  {

    
  int a =5;
  int b =10;
  int temp;
  
    Console.WriteLine("Before swap a = "+a + " b = "+ b);
    
  temp = a;
  a = b;
  b = temp;
    
    Console.WriteLine("After swap a = "+a + " b = " + b);

  }

}

Another way to swap two numbers

using System;  
  public class SwapExample  
   {  
     public static void Main(string[] args)  
      {  
       int  a=5, b=10;            
       Console.WriteLine("Before swap a= "+a+" b= "+b);    
       a=a*b; //a=50 (5*10)      
       b=a/b; //b=5 (50/10)      
       a=a/b; //a=10 (50/5)    
       Console.Write("After swap a= "+a+" b= "+b);       
     }  
  }

swap two numbers with user inpu

using System;
public class Exercise5
{
       public static void Main(string[] args)
         {
            int number1, number2, temp;
            Console.Write("\nInput the First Number : ");
            number1 = int.Parse(Console.ReadLine());
            Console.Write("\nInput the Second Number : ");
            number2 = int.Parse(Console.ReadLine());
            temp = number1;
            number1 = number2;
            number2 = temp;
            Console.Write("\nAfter Swapping : ");
            Console.Write("\nFirst Number : "+number1);
            Console.Write("\nSecond Number : "+number2);
            Console.Read();
        }
}