Home » C Programming » Data Types » Question
  1. 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 ;
    }
    1. 3.000000 2.000000
    2. 2.500000 2.500000
    3. 2.550000 3.000000
    4. 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



Your comments will be displayed only after manual approval.