Question: Suppose the following code fragment has been executed: double x = 2.9; double y,z; y = (int)x + 0.1; printf(%.1f,y); /* A */ z =

Suppose the following code fragment has been executed:

double x = 2.9;

double y,z;

y = (int)x + 0.1;

printf(%.1f,y); /* A */

z = (int)(x+0.1);

printf(%.1f,z); /* B */

What is printed by the printf statement on line B?

A.

2

B.

2.1

C.

2.9

D.

3

E.

3.0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!