Monday, 30 September 2019

Swap three number without fourth variable

Swap three number without fourth variable
using System;
namespace ConsoleApplicationSample
{
    class SwapNumber
    {
        public static void Main()
        {//Swap three number without fourth variable
            int a, b, c;
            a = 10;
            b = 20;
            c = 30;
            c = a + b + c;
            a = c - (a + b);
            b = c - (a + b);
            c = c - (a + b);
            Console.Write("a= " + a + " b= " + b + " c= " + c);
            Console.ReadLine();
        }
    }
}
https://www.youtube.com/channel/UCKLRUr6U5OFeu7FLOpQ-FSw/videos

0 comments

Post a Comment