Computer Science, asked by SusanneCarter, 5 months ago

Evaluate the following expression :-

q = q*++p where q is 18 and p is 5.​

Answers

Answered by BrainlyProgrammer
2

Question:-

q=q*++p

Given:-

q=18

p=5

To evaluate:- q=q*++p

Solution:-

q=q*++p

>>>q=18*6. //Note the increment type...

>>>q=108

___________

Note:-

  • ++p is prefix increment that is first increase the value then calculate.
  • So p first increases to 6 then gets multiplied with orignal value of q that is 18
  • finally, we gets 108 as the answer which is the new value of q
  • The final value of both p and q are given in "Correct Answer".

__________

Correct Answer :-

q=108

p=6

Similar questions