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 4 of 8.
Shivaprabhu said:
1 decade ago
Good explanation by binit.
Saurav said:
1 decade ago
What is use of ceil function?
Sravya said:
1 decade ago
Good explanation by binit.
Klakston said:
1 decade ago
Weather are we using roundup and roundto function for program or not?
Deepthi sai said:
1 decade ago
What is the difference between ceil() and round() ?. Please I need a clear description.
Ramamohan said:
1 decade ago
Hi my dear friends can you explain how to use roundup and roundto functions ?
Chandan said:
1 decade ago
I take daily life exa.
Ceil mean ceiling fan i.e. Upper limit
Floor mean ground i.e. Lower limit
Here I take upper limit mean +positive infinity n lower is -neg
Infinity
During ceil function we round value toward positive value
i.e. 3.2=4
3.6=4
2.1=3
Ceil mean ceiling fan i.e. Upper limit
Floor mean ground i.e. Lower limit
Here I take upper limit mean +positive infinity n lower is -neg
Infinity
During ceil function we round value toward positive value
i.e. 3.2=4
3.6=4
2.1=3
Sri said:
1 decade ago
Thank you for u'r logic legend explanation chandan.
Manikandan said:
1 decade ago
What is the difference b/w ceil & floor, and also explain the work of roundup and roundto ?
What is the use of ceil() and floor() function?
What is the use of ceil() and floor() function?
Raghu Teja said:
1 decade ago
I understood about ceil and need more clarity about floor().
Can anyone explain me about floor() with an suitable example?
Can anyone explain me about floor() with an suitable example?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers