Question: We want to round off x , a float , to an int value, The correct way to do is

Options

A : y = (int)(x + 0.5)

B : y = int(x + 0.5)

C : y = (int)x + 0.5

D : y = (int)((int)x + 0.5)

Click to view Correct Answer

Previous || Next

Floating Point Issues - General Questions more questions

What are the different types of real data type in....

What will you do to treat the constant 3.14 as....

If the binary eauivalent of 5.375 in normalised form is....

Which of the following range is a valid long double....

Which statement will you add in the following program to....

The binary equivalent of 5.375 is

A float occupies 4 bytes. If the hexadecimal equivalent of....

What will you do to treat the constant 3.14 as....

Which of the following statement obtains the remainder on dividing....

The keyword used to transfer control from a function back....

Arrays - General Questions more Online Exam Quiz

Complicated Declarations - General Questions

Control Instructions - General Questions

Declarations and Initializations - General Questions

Strings - General Questions