Computer Science, asked by brainblizzard86, 4 hours ago

write the output m=0,n=30,q=40 m= --n +q + ++n​

Answers

Answered by kunalkale012
0

Answer:

99

Explanation:

--n = 29

q = 40

++n = 30

m= 29+ 40 + 30 = 99

Answered by anindyaadhikari13
2

ANSWER.

  • m = 99
  • q = 40
  • n = 30

SOLUTION.

Given –

→ m = 0

→ n = 30

→ q = 40

> m = --n + q + ++n

> m = 29 + q + ++n (n becomes 29, pre-decrement)

> m = 29 + 40 + ++n (value of q is substituted here)

> m = 29 + 40 + 30 (n becomes 30, pre-increment)

> m = 29 + 70

> m = 99

So,

→ m = 99

→ n = 30

→ q = 40

LEARN MORE.

There are two types of increment/decrement operations.

  1. Post increment/decrement.
  2. Pre increment/decrement.

Post Increment/Decrement – Here, operation takes place first and then the value is incremented/decremented.

Example –

> int a = 2;

> int b = a++;

> b = 2

Now, a = 3.

Pre Increment/Decrement – Here, value is first increment/decrement and then the operation is carried out.

Example –

> int a = 2;

> int b = ++a;

> b = 3

Also, a = 3

Similar questions