C Programming - Declarations and Initializations - Discussion

Discussion Forum : Declarations and Initializations - General Questions (Q.No. 5)
5.
How would you round off a value from 1.66 to 2.0?
ceil(1.66)
floor(1.66)
roundup(1.66)
roundto(1.66)
Answer: Option
Explanation:
/* Example for ceil() and floor() functions: */

#include<stdio.h>
#include<math.h>

int main()
{
    printf("\n Result : %f" , ceil(1.44) );
    printf("\n Result : %f" , ceil(1.66) );
 
    printf("\n Result : %f" , floor(1.44) );    
    printf("\n Result : %f" , floor(1.66) );

    return 0;
}
// Output:
// Result : 2.000000
// Result : 2.000000
// Result : 1.000000
// Result : 1.000000
Discussion:
80 comments Page 1 of 8.

Pavan Shinde said:   8 years ago
@All.

ceil()---> Means up.(for ex: 1.66----> 2.000000).
floor()--->Means Down.(for ex:1.44--->1.000000).
(22)

Vini said:   6 years ago
Thanks all for explaining it clearly.
(9)

V. Sai Prathyusha said:   6 years ago
I can't understand this. Please explain once.
(8)

V. Sai Prathyusha said:   6 years ago
Anyone, please write the program using four functions.
(7)

Ruchitha said:   7 years ago
I can't get it, please explain me guys.
(2)

Sonali said:   8 years ago
What is the meaning of roundup and roundto function?
(2)

Siva sri said:   4 months ago
Thanks for explaining the answer.
(1)

Aka said:   6 months ago
Nice, good. Thanks all for explaining.
(1)

Asha said:   1 decade ago
What is an round off? How the given program get execute?

Alina said:   1 decade ago
ceil(1.44) = 1.00 and roundup(1.44) = 1.00 so both are same?


Post your comments here:

Your comments will be displayed after verification.