Examlex

Solved

Each of the Following Lines of Code Purport to Round

question 5

Essay

Each of the following lines of code purport to round the results of the division of doubles to the nearest integer value (but still of type double).All are correct C++ code but some do not round correctly.Tell which rounds down,up,or to the nearest integer value,or is not reasonable
Assume that math.h has been included,and that all variables have appropriate values.
double x,y,z;
a)z = ceil(x/y);
b)z = ceil(x/y-0.5);
c)z = floor(x/y-0.5);
d)z = floor(x/y+0.5);
e)z = floor(x/y);


Definitions:

Focal Point

A central or primary element in a particular setting that draws attention or serves as a reference for surrounding activities.

Territory

An area of land under the jurisdiction of a ruler or state, often marked by boundaries.

Decisions

The act or process of making choices or judgments based on available information, reasoning, and possibly emotional factors.

Emphasis

The special importance or significance placed on something.

Related Questions