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);


a) rounds up -- to the next integer greater than or equal to x/y
b) OK rounds to the integer nearest to x/y, exact 1/2 values round down
c) not reasonable. x/y with value 1.25 gives 0 result.
d) OK rounds to the integer nearest to x/y, exact 1/2 values round up
e) rounds down to the next integer less than or equal to x/y

Computer Science & Information Technology

You might also like to view...

AutoFiltering allows

a. sorting rows b. displaying rows with a limited number of values c. displaying rows that match specific criteria d. all of the above

Computer Science & Information Technology

A ________ is a reserved area at the top of each page

A) footer B) header C) table D) template

Computer Science & Information Technology

________ is the component of the information system that is described as the equipment that processes data to create information.

A. Compiler B. Programming C. Hardware D. System software

Computer Science & Information Technology

What is the default maximum number of MFA devices in use per AWS account (at the root account level)?

A. 1 B. 5 C. 15 D. 10

Computer Science & Information Technology