mcqs bucket

  • MCQs Bucket | Program Write a C# Sharp program to swap two numbers.

    mcqsbucket

      Best guide for exams of all nature, Competitive exams and Interviews

Write a C# Sharp program to swap two numbers.

	 
                                 		

using System;
 public class swap
{
   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();
     }
}