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:

Commission

Commission refers to a fee paid for services or a percentage of sales earned by sales employees or agents on the transactions they facilitate.

Cash Dividends

A form of profit distribution by a corporation to its shareholders, paid in cash from the company's current or retained earnings.

Trading Securities

Financial assets that are purchased by an entity not for long-term investment but rather with the intention to sell them in the near term to make a profit.

Fair Value

The estimated market value of an asset or liability based on current market prices or valuations.

Related Questions