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

Complete the following table by writing the value of each expression in the Valu

ID: 3687542 • Letter: C

Question

Complete the following table by writing the value of each expression in the Value column. Expression Value 28/4 -2 6 + 12 * 2 - 8 4 + 8 * 2 6 + 17 % 3 - 2 2 + 22 * (9 - 7) (8+ 7)* 2 (16 +7)% 2 - 1 12/(10-6) (19 - 3) *(2 + 2)/4 Write C++ expressions for the following algebraic expressions: a = 12x z = 5x +14y +6k y = x^4 g = h + 12/4k c = a^3/b^2k^4 assume a program hs the following variable definitions: int units;float mass; double weight; and the following statement weight = mass * units; which automatic data type conversions will take place?

Explanation / Answer

8)
operator precedence rule: () / % * + -
(i) 28/4 - 2 ===> 7-2 = 5
(ii) 6+12*2-8 ===> 6+24-8 ==> 22
(iii) 4+8*26+17%3-2 ===> 4 + 208 + 2 -2 ==> 212
(iv) 2 + 22 * (9-7) ==> 2 + 22 * 2 ==> 2+44 = 46
(v) (8+7) * 2(16+7)%2-1 ==> (15) * 2(23)%2 -2 ==> 15 * 2(1) - 2 ==> 30-2 = 28
(vi) 12 / (10-6) ==> 12 / 4 == 3
(vii) (19-3)*(2+2)/4 ===> (16)*(4/4) == > 16*1 = 16

------------------------------------------------------------------------
9) c++ expressions ....

A) g = 12x

int x,g;
g = 12 * x;

----------------------------------
B)
z = 5x + 14y+6k;

int x,y,k,z;
z = 5*x + 14*y + 6*k;

-----------------------------------
C) y = x^4;
  
int x,y;
y = pow(x,4);

----------------------------------------
D)
g = (h+12)/4k

int g,h,k;
g = (h+12)/4*k;

------------------------------------------
E)
c = a^3 / b^2 k^4

int a,b,c,k;
c = pow(a,3) / (pow(b,2) * pow(k,4));