Evaluate the value of the expression :
6 - 2 + 10 % 4 + 7
Answers
Answered by
27
Explanation:
to the precedence order of comp signs. first % is solved. then + and -. 6-2+10%4+7.
6-2+2+7
4+8
13.
Mark as Brainlist
Answered by
7
6 - 2 + 10 % 4 + 7 = 13.
- We can evaluate this expression with the help of operator precedence. Operator precedence decides the order in which terms may be evaluated. Certain operators have lower precedence than other operators.
- For example, the multiplication operator has higher precedence than the addition operator and subtraction operator.
- 6 - 2 + 10 % 4 + 7. Since modulus operand has a higher priority than + and -, so modulus operator would be solved first.
⇒ 10 % 2 = 2.
⇒ Now, we have the equation,
⇒ 6 - 2 + 2 + 7.
- Now, + and - have the same precedence, hence now we can evaluate the expression from left to right.
⇒ (6 - 2) + 2 + 7
⇒ 4 + 2 + 7
⇒ 13.
Hence, 13 is the answer of expression 6 - 2 + 10 % 4 + 7.
Similar questions