Evaluate the expression in C++.

Q21. Identify the order of evaluation in the following expression:

4*5+7*2-8%3+4&&4/2-1+4||2-4||2-4+6*2.

Ans. First of all * will be performed.

Expression after performing multiplication:

20+14-8%3+4&&4/2-1+4||2-4||2-4+12

Expression after performing division:

20+14-8%3+4&&2-1+4||2-4||2-4+12

Expression after performing modulus:

20+14-2+4&&2-1+4||2-4||2-4+12

Expression after performing addition and subtraction:

36&&5||-2||10

Expression after performing Logical &&

1||-2||10

Expression after performing Logical ||

1||10

1

Leave a Reply

Your email address will not be published. Required fields are marked *

75 Views
%d bloggers like this: