Computer Science, asked by sarthakkhandelwal599, 1 year ago

What is the value of m after evaluating the following expression:m -= 9%++n + ++n/2; when int m=10,n=6.
Pls Answer Now..

Answers

Answered by siddhartharao77
114

We have,

int m = 10, n = 6.

Program:

m-= 9%++n + ++n/2;

Output:

4

Explanation:

m = 10 - [9%++n + ++n/2]

   = 10 - [9%7  +  8/2]

   = 10 - [2 + 4]

   = 10 - 6

   = 4.

Modulo operator(%) computes remainder.

Hope it helps!

Answered by Anonymous
47

Answer:

m- = 9% ++n + ++n/2

⇒ m = m - ( 9% ++n + ++n/2 )

⇒ m = 10 - ( 9% 7 +8/2 )

⇒ m = 10 - ( 2 + 4 )

⇒ m = 10 - 6

⇒ m = 4

The value of m is 4 .

Explanation:

(%) is called the modulus operator which tells us the remainder after dividing a number .

++a is known as the increment operator .

The increment operator which is written before the operand adds 1 to the operand before the next operation .

The operator which works on two operators is called binary operator .

The operator which works on one operator is called unary operator .

Unary operators are either postfix or prefix .

Similar questions