Which of the following assignments are valid if an


Question:
int num1, num2, newNum;
double x, y; 
Which of the following assignments are valid? If an assignment is not valid, state the reason.
When not given, assume that each variable is declared.
a. num1 = 35;
b. newNum = num1 - num2;
c. num1 = 5; num2 = 2 + num1; num1 = num2 / 3;
d. num1 * num2 = newNum;
e. x = 12 * num1 - 15.3;
f. num1 * 2 = newNum + num2;
g. x / y = x * y;
h. num2 = num1 % 2.0;
i. newNum = static_cast (x) % 5;
j. x = x + y - 5;
k. newNum = num1 + static_cast (4.6 / 2)

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Which of the following assignments are valid if an
Reference No:- TGS01152553

Now Priced at $14 (50% Discount)

Recommended (91%)

Rated (4.3/5)