Problem

What values are assigned by the legal statements in Exercise, assuming a is 7 , b is 3 , a...

What values are assigned by the legal statements in Exercise, assuming a is 7 , b is 3 , and y is 2.0 ?

Exercise

Given the constants and variable declarations

#define PI 3.14159#define MAX_I 1000. . .double x, y;int a, b, i;

indicate which of the following statements are valid, and find the value stored by each valid statement. Also indicate which are invalid and why. Assume that a is 3 , b is 4 , and y is −1.0 .

a. i = a % b;

b. i = (989 − MAX_I) / a;

c. i = b % a;

d. x = PI * y;

e. i = a / −b;

f. x = a / b;

g. x = a % (a / b);

h. i = b / 0;

i. i = a % (990 − MAX_I);

j. i = (MAX_I − 990) / a;

k. x = a / y;

l. i = PI * a;

m. x = PI / y;

n. x = b / a;

o. i = (MAX_I − 990) % a;

p. i = a % 0;

q. i = a % (MAX_I − 990);

r. x = (double) a / b;

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 2.5