Swap Two Numbers Without using Third Variable - C# Program

Swap Two Numbers Without using Third Variable

using System;
namespace SwapDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b;
            Console.Write("Enter Value of Number A:");
            a = Convert.ToInt32(Console.ReadLine());
            Console.Write("Enter value of Number B:");
            b = Convert.ToInt32(Console.ReadLine());
            a = a + b;
            b = a - b;
            a = a - b;
            Console.WriteLine("After swapping A={0} B={1}", a, b);
        }
    }
}

Output - C# Swap Number Application

Enter Value of Number A: 10
Enter Value of Number B: 20
After swapping A=20 B=10