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 7 of 8.
Deepa said:
1 decade ago
What is round of value and ceil () ?
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?
Sri said:
1 decade ago
Thank you for u'r logic legend explanation chandan.
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
Ramamohan said:
1 decade ago
Hi my dear friends can you explain how to use roundup and roundto functions ?
Deepthi sai said:
1 decade ago
What is the difference between ceil() and round() ?. Please I need a clear description.
Klakston said:
1 decade ago
Weather are we using roundup and roundto function for program or not?
Sravya said:
1 decade ago
Good explanation by binit.
Saurav said:
1 decade ago
What is use of ceil function?
Shivaprabhu said:
1 decade ago
Good explanation by binit.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers