Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Examine ways to output results using output statements Do the following problems

ID: 3883384 • Letter: E

Question

Examine ways to output results using output statements Do the following problems. For assignment submission, use the format listed in the syllabus. Problem 01-4.5 points Evaluate the following expressions. a. 28 - 3 + 6 b. 6/5 c. 3*6/2 - 15 d. 4 - 6% 11 e. 37/4.0 f. 15 + 18% 2 - 20/6 g. 32 % 12 + 6 - 36/5 * 8 h. 5/9 * (32.6 - 4.5) i. 18.0 + 5.0* 3.0/4.0 Problem 02-2 points Suppose x, y, z, and w are int variables. What value is assigned to each of these variables after the last statement executes? x = 12: y = 18: z = x - 5/x: x = z - y: y = x + 3 * z: w = x - y + 2 * z: w++: z = 2 * y + w - x;

Explanation / Answer

Evaluating the expressions:

A common technique we need to remember a abbrevations PEMADS.

1. Paraentheses

2. Exponents

3. Multiplication and Division (from left to right)

4. Addition and Subtraction (from left to right)

a. 28-3+6

= 25+6 (from left to right)

= 31

b. 6/5 = 1.2

c. 3*6 / 2-15

18/2-15

9 - 15 = -6

d. 4-6 % 11

4- 66/100

4 - 0.66 = 3.34

e. 37/ 4.0 = 9.25

f. 15 + 18 % 2 - 20/6

15 + 36/100 - 20/6

15 + 0.36 - 3.33

15.36-3.33 = 12.03

h. 5/9 * (32.6 - 4.5 )

5 / 9 * 28.1

0.55 * 28.1 = 15.61

i 18.0 + 5.0 * 3.0 / 4.0

18.0 + 15.0 / 4.0

18.0 + 3.75 = 21.75

------------------------------------------------------------------------------------------------------

X = 12; Y = 18

Z = X - 5 / X;

= 12 - 5 / 12

= 12 - 0416

= 11.583

X = Z - Y

= 11.583 - 18

= -6.417

Y = X + 3 * z

= -6.417 + 3 * 11.583

= -6.417 + 34.749

= 28.332

W = X - Y + 2 * Z

= -6.417 - 28.332 + 2 * 11.583

= -6.417 - 28.332 + 23.166

= -34.749 + 23.166

= - 11.583

W++ = -10.583

Z = 2 * Y + W - X

= 2 * 28.332 + -10.583 - -6.417

= 56.664 - 10.583 + 6.417

= 46.08 + 6.417

= 52.497

So final values are

x = -6.417

y = 28.332

z = 52.497

w = -10.583

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote