public static void ExchangeInteger()
{
int a = 10;
int b = 5;
Console.WriteLine("a={0}", a);
Console.WriteLine("b={0}", b);
a = a + b; // Now a would be 15
b = a - b; // Now b would be 15-5=10 ........
a = a - b; // Now a would be 15-10=5........
Console.WriteLine("a={0}", a);
Console.WriteLine("b={0}", b);
Console.ReadLine();
}
Liked By
Write Answer
Exchange Two integer variable value without using third variable.
Join MindStick Community
You have need login or register for voting of answers or question.
Anonymous User
29-Mar-2019