1)

What will the output of the following set of code?

static void Main(string[] args)
{
int a, b, c, x;
a = 80;
b = 10;
c = 3;
x = a - b / 3 + c * 2 - 1;
Console.WriteLine(x);
Console.ReadLine();
}


A) 84

B) 82

C) 90

D) 80

Answer:

Option B

Explanation:

The order of evaluation happens according to the precedence of arithmetic operators.
X = 80 – 10/3 + 3 * 2 – 1

  1. 10/3 = 3
  2. 3*2 = 6
  3. 80-3 = 77
  4. 77+6 = 83
  5. 83-1 = 82