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:
80 comments Page 5 of 8.
Teju said:
2 decades ago
What is difference between roundup() and roundto().
Are they math fn's or not?
Are they math fn's or not?
Jhishu said:
2 decades ago
Thanks to S. Sasikumar.
Ranjith said:
9 years ago
Yes, correct @Akshatha.
Sindhu said:
2 decades ago
What is use of roundup and roundto?
Sindhu said:
2 decades ago
What is difference between roundup() and roundto() ?
Purnima said:
1 decade ago
@sasi.
Here you are saying that for >. 5 then only the valu will round to next higest integer but if we give as ceil (2. 1) also we get ans as 3 then how?
And for roundup value is it >. 5 or may anything?
Here you are saying that for >. 5 then only the valu will round to next higest integer but if we give as ceil (2. 1) also we get ans as 3 then how?
And for roundup value is it >. 5 or may anything?
Deepa said:
1 decade ago
Thanks.
Sri said:
1 decade ago
Roundoff means? here why we chose the ceil function only?
Bhavana said:
1 decade ago
Good explanation by sasikumar.
HIMANSHU said:
1 decade ago
Binit and Suresh is quite right!!
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers