Evaluate these expressions using the arithmetic operator precedence rules. Be ex
ID: 3528069 • Letter: E
Question
Evaluate these expressions using the arithmetic operator precedence rules. Be explicit in writing your answers. If a solution is a floating point number which continues on for more than two decimal digits, then round the answer to two decimal digits. int a = 123, b = 11, c = -7, d = 32, x; double n = 21.5, m = 5.28, p = -7.56, z; (a) x = a + b + c; What value is assigned to x? (b) x = a + b * c; What value is assigned to x? (c) x = (a + b) * c; What value is assigned to x? (d) x = 3 * a % d; What value is assigned to x? (e) x = (-b * c) % d; What value is assigned to x? (f) z = -(n - m) * p; What value is assigned to z? (g) x = a / d; What value is assigned to x? (h) z = a / d; What value is assigned to z? (i) z = static_cast(a) / d; What value is assigned to z?
Explanation / Answer
1) x =127 2) x= 46 3) x= -938 4) x= 369 % 32 =17 // * / % same precedence and processed from left to right 5) x= 77 % 32 = 13 6)z= -122.62 7) x = 3 8) z=3.84 9) z= 3.84
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.