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:
79 comments Page 7 of 8.

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

Aka said:   2 weeks ago
Nice, good. Thanks all for explaining.

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

Deepa said:   1 decade ago
What is round of value and ceil () ?

Anil Soni said:   1 decade ago
What is roundup() & why we use?

Sindhu said:   1 decade ago
What is use of roundup and roundto?

HIMANSHU said:   1 decade ago
Binit and Suresh is quite right!!

Bhavana said:   1 decade ago
Good explanation by sasikumar.

Saurav said:   1 decade ago
What is use of ceil function?

Sai prashanthi said:   1 decade ago
Thanks to sasi and jayashri.


Post your comments here:

Your comments will be displayed after verification.