Swapping Two Integer Number Without Using Temp/Third Variable in .NET
Part-1 :: Swapping Two Integer Number without using Temp/Third Variable.
namespace SwappingWithoutUsingTempVariable
{
class Program
{
static void Main(string[] args)
{
int a = 10;
int b = 20;
Console.WriteLine("First Number = {0} and Second Number = {1}",a ,b);
a += b;
b = a - b;
a = a - b;
Console.WriteLine("First Number = {0} and Second Number = {1}", a, b);
Console.ReadLine();
}
}
}
No comments:
Post a Comment