using System; class Mark { int a,b,temp; \\ taking three variable. public void Swapnum() \\ here i take input on this function { Console.WriteLine("Enter your 1st number"); a=Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter your 2st number"); b=Convert.ToInt32(Console.ReadLine()); } public void Swapsum() { temp=a; \\ stroing value of 'a' on temp a=b; \\stroing value of 'b' on 'a' b=temp; \\stroing value of 'temp' on 'b' } public void Display() { Console.WriteLine("your swap number is --: {0}",a); Console.WriteLine("your swap number is --: {0}",b); } public static void Main() { Mark av=new Mark(); av.Swapnum(); av.Swapsum(); av.Display(); } }
Comments
Post a Comment