Computer Science, asked by swayamnagarale077, 6 hours ago

solve using operator predesence int a = 2, b = 6; int result = b / a + b %solve a;​

Answers

Answered by purveshKolhe
2

\huge{\green{\boxed{\blue{\mathfrak{ answer ::   }}}}}

Operator precedence is -- Brackets, division, multiplication, then addition or subtraction since both of them have equal precedence.

Value of int a = 2

Value of int b = 6

Let us convert it in a côde--

int a = 2;

int b = 6

int result = b / a + b % a;

System.out.print(result);

Now let us answer it step by step--

  1. b / a => 6 / 2 = 3
  2. 3 + b % a => b % a => 6 % 2 = 3
  3. 3 + 3 = 6

Therefore, 6 is our answer.

Note:-- % is used for obtaining remainder.

I hope that my answer helps you...

Similar questions