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 4 of 8.

Nikita said:   1 decade ago
What is the difference b/w ceil & floor, and also explain the work of roundup and roundto ?

Poorni said:   1 decade ago
What is mean by ceil and round to? What is the difference between ceil, roundto and roundup?

Deepthi sai said:   1 decade ago
What is the difference between ceil() and round() ?. Please I need a clear description.

Teju said:   1 decade ago
What is difference between roundup() and roundto().

Are they math fn's or not?

Parmar Vishal said:   1 decade ago
Confusion!!! But some time both the function is give the same out put confuse!

Dhanshri said:   1 decade ago
Friends there is no any functions like roundup() and roundto() in C language.

Ramamohan said:   1 decade ago
Hi my dear friends can you explain how to use roundup and roundto functions ?

Cutie said:   1 decade ago
What is the difference between ceil & roundup and floor & roundto?

Revathi said:   1 decade ago
Please tell me. We use roundto() instead of roundup(). Is it possible?

Klakston said:   1 decade ago
Weather are we using roundup and roundto function for program or not?


Post your comments here:

Your comments will be displayed after verification.