Tuesday, 28 May 2019

Assignment Operator Used C# Program


Assignment Operator



using System;
namespace Assignment_Operator_used_Program
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = 10;
            int c;

            c = a;
            Console.WriteLine("Line 1 - Value of c={0}",c);

            c += a;
            Console.WriteLine("Line 2 - Value of c={0}", c);

            c -= a;
            Console.WriteLine("Line 3 - Value of c={0}", c);

            c *= a;
            Console.WriteLine("Line 4 - Value of c={0}", c);

            c /= a;
            Console.WriteLine("Line 5 - Value of c={0}", c);

            c %= a;
            Console.WriteLine("Line 6 - Value of c={0}", c);

            c <<= a;
            Console.WriteLine("Line 7 - Value of c={0}", c);

            c >>= a;
            Console.WriteLine("Line 8 - Value of c={0}", c);

            Console.ReadKey();
        }
    }
}

No comments:

Post a Comment