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

Shivkumar said:   8 years ago
What is difference between ceil() and floor() funtion?

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

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

Sindhu said:   1 decade ago
What is difference between roundup() and roundto() ?

Sri said:   1 decade ago
Thank you for u'r logic legend explanation chandan.

Kmahender said:   1 decade ago
I want to know about different types of functions.

Sneha said:   1 decade ago
What the difference between roundup() and ceil()?

Sayed Nasir said:   1 decade ago
What is the use of ceil() and floor() function?

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

Xyz said:   9 years ago
When we use roundup() and ceil() functions?


Post your comments here:

Your comments will be displayed after verification.