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?
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 1 of 8.
Aka said:
2 weeks ago
Nice, good. Thanks all for explaining.
Vini said:
5 years ago
Thanks all for explaining it clearly.
(9)
V. Sai Prathyusha said:
6 years ago
Anyone, please write the program using four functions.
(7)
V. Sai Prathyusha said:
6 years ago
I can't understand this. Please explain once.
(8)
Ruchitha said:
6 years ago
I can't get it, please explain me guys.
(2)
Pavan Shinde said:
7 years ago
@All.
ceil()---> Means up.(for ex: 1.66----> 2.000000).
floor()--->Means Down.(for ex:1.44--->1.000000).
ceil()---> Means up.(for ex: 1.66----> 2.000000).
floor()--->Means Down.(for ex:1.44--->1.000000).
(22)
Sonali said:
8 years ago
What is the meaning of roundup and roundto function?
(1)
Ranjith said:
8 years ago
Yes, correct @Akshatha.
Amulya said:
8 years ago
If ceil() round of to next value if it is greater than or equal to 5 then why is 1.44 is round off to 2.000000 and not 1.000000 it is less than 5, right?
Shivkumar said:
8 years ago
What is difference between ceil() and floor() funtion?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers