Swap Two Numbers Without using Third Variable in C#

This blog demonstrates how to swap the value of two variables without using the third variable.

Introduction

The given below code swaps two given values of variables without using the third variable in C#.

namespace CDEMO.

{
class
Program
{

     static void Main(string[] args)

     {

           int first,second ;

           first = 1;

           second = 2;
           first = first + second;

           second = first - second;

           first = first - second;

           Console.WriteLine(first.ToString());

            Console.WriteLine(second.ToString());

            Console.ReadLine();

        }

     }

}