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

1. For each of the following expressions, give the resulting values and the corr

ID: 3889428 • Letter: 1

Question

1.   For each of the following expressions, give the resulting values and the corresponding types.

                                                DATA             DATA

                                                VALUE          TYPE

     a.   54 + 15/6                   __________ __________

     b. 21 % 9 % 7                __________ __________

     c. 25 / (2 * 5.0)               __________ __________

     d. 9 % 9 + 14 / 3            __________ __________

     e. –19 + (-6.0)

                                                __________ __________

2.   Write a C++ definition to create a constant called daysPerYear which contains the value 365.

3.   Write the following expressions in C++.

     a. A2 + 4B + 1                             ___________________________________

+ 4

Explanation / Answer

1)
a) 54 + 15/6 = 54+2.5 = 56.5.
data value = 56.5 and datatype = float

b)21%9%7
data value = 1 and datatype = int(integer)

c)5 / (2 * 5.0)
data value = 2.5 and datatype = float.

d) 9 % 9 + 14 / 3
data value = 4.66666667 and datatype = double.

e)-25
data value = -25 and datatype = signed integer.

2)const unsigned short daysPerYear = 365;