Print Friendly and PDF
(Order of Evalution) State the order of evaluation of the operators in each of the following C++ statements and show the value of x after each statement is performed. a) x = 7 + 3 * 6 / 2 - 1; b) x = 2 % 2 + 2 * 2 - 2 / 2; c) x = ( 3 * 9 * ( 3 + ( 9 * 3 / ( 3 ) ) ) );
(Order of Evalution) State the order of evaluation of the operators in each of the following C++ statements and show the value of x after each statement is performed.

a) x = 7 + 3 * 6 / 2 - 1;
b) x = 2 % 2 + 2 * 2 - 2 / 2;
c) x = ( 3 * 9 * ( 3 + ( 9 * 3 / ( 3 ) ) ) );

Solution:


a) 2, 3, 1, 4 (15)

b) 1, 3, 5, 2, 4 (3)

c) 4, 5, 3, 1, 2 (324)
zubairsaif

Zubair saif

A passionate writer who loves to write on new technology and programming

Post A Comment:

1 comments: