use of operator precedence in C#

 

For Example : Write a program to demonstrate the use of operator precedence.

class Program

    {

        public static void Main(string[] args)

        {

            int x;

            int a = 7, b = 3, c = 2;

            x = a + b * c; // here arithmetic problem is solved followed by precedence

            Console.WriteLine("Result is After Solving:" + x);

            Console.ReadLine();

        }

    }

Output:

      

Comments

Popular posts from this blog

simple program C#

Regular Expression Validator Control in asp.net

two dimension array in C#