Question
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)
Posted under C Programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the correct way to round offx, a float, to an int value?
Similar Questions
Discover Related MCQs
Q. By default, any real number in 'C' is treated as
View solution
Q. To print out a and b given below, which printf() statement would you use?
float a = 3.14;
double b = 3.14;
View solution
Q. When a variable of data type double is converted into float, then
View solution
Q. The library function sqrt operates on a double precision argument. If, i is an integer variable, then which of the following calls would correctly compute sqrt(i)?
View solution
Q. The statement
printf( " % f ", ( float )9/5) ;
prints
View solution
Q. The declaration
enum cities{ bethlehem, jericho, nazareth = 1, jerusalem }
assigns the value 1 to
View solution
Q. Integer division in a 'C' program results in:
View solution
Q. In a 'C'expression involving || operator, evaluation
View solution
Q. In C programming language, which of the following operators has the highest precedence?
View solution
Q. If i j,k are integer variable with values 1,2,3 respectively, then what is the value of the expression
!((j + k) > (i + 5))
View solution
Q. The expression a << 6 shifts all bits of a six places to the left. If a Ox6db7, then what is the value of a << 6
View solution
Q. The expression 5 - 2 - 3 * 5 - 2 will evaluate to 18, if - is left associative and
View solution
Q. Choose the correct statements
View solution
Q. In an operation involving || operator, evaluation
View solution
Q. Pick the operators that assosciate from the left
View solution
Q. Pick the operators that assosiate from the right
View solution
Q. The operators . , || , < , = , if arranged in the ascending order of precedence reads
View solution
Q. Pick the operators that assosiate from left to right
View solution
Q. Pick the operators whose meaning is context dependent
View solution
Q. Which of the following comments about the ++ operator are correct ?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond C Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!