-
Which of the following is the correct output for the program given below?
#include <stdio.h>
int main ( )
{
float n = 2.39;
printf("%f %f\n", ceil (n), floor (n)) ;
return 0 ;
}
-
- 3.000000 2.000000
- 2.500000 2.500000
- 2.550000 3.000000
- 2.000000 3.000000
Correct Option: A
ceil(n) round up the given value. It finds the smallest integer not < n.
floor(n) round down the given value. It finds the smallest integer not > n.
So output is
3.000000 2.000000