Suppose x, y, and z are int variables and w and t are double variables. What are the values of all five variables after all the following statements have been executed? Hint, the mod operator is the same level of precedence as * and /, and be careful about integer division. x = 17; y = 15; x = x + y / 4; z = x % 3 + 4; w = 17 / 3 + 6.5; t = x / 4.0 + 15 % 4 - 3.5;

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 7SA: Consider the following statements: Which of the following statements are valid? If they are...
icon
Related questions
Question

Suppose x, y, and z are int variables and w and t are double variables. What are the values of all five variables after all the following statements have been executed? Hint, the mod operator is the same level of precedence as * and /, and be careful about integer division.

x = 17;

y = 15;

x = x + y / 4;

z = x % 3 + 4;

w = 17 / 3 + 6.5;

t = x / 4.0 + 15 % 4 - 3.5;

Expert Solution
steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Knowledge Booster
Name constants and Literal values
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning