using System;
public class Swapping
{
void Swap(ref int a, ref int b)
{
int temp;
temp=a;
a=b;
b=temp;
}
static void Main(string [] arg)
{
Swapping obj=new Swapping();
int n1,n2;
Console.WriteLine("Enter the no's:\t");
n1=Convert.ToInt32(Console.ReadLine());
n2=Convert.ToInt32(Console.ReadLine());
obj.Swap(ref n1, ref n2);
Console.WriteLine("The values of the numbers before swapping is :\t"+n1);
Console.WriteLine("The values of the numbers before swapping is :\t"+n2);
Console.ReadLine();
}
}
Labels: C# Programming