Swapping of Two Values without using Third Variable

Using signs + and - for swapping of two values.

Using signs + and - for swapping of two values.

using system;

namespace TestConsole
{

    class
Program

    {

        static void Main()

        {

            int a = 10;

            int b = 20;

            Console.write("After swap a = {0} and b = {1}", a, b);

            a = a + b;
// a * b

            b = a - b;
// a / b

            a = a - b;
// a / b

            Console.Write("After swap a = {0} and b = {1}", a, b);

        }

    }

}