Syntax
#include <math.h> double ceil(double x);Description
ceil returns the integer as a double value.
This example sets y to the smallest integer greater than 1.05, and then to the smallest integer greater than -1.05. The results are 2.0 and -1.0, respectively.
#include <stdio.h>
#include <math.h>
int main(void)
{
double y,z;
y = ceil(1.05); /* y = 2.0 */
printf("ceil( 1.05 ) = %5.f\n", y);
z = ceil(-1.05); /* z = -1.0 */
printf("ceil( -1.05 ) = %5.f\n", z);
return 0;
/****************************************************************************
The output should be:
ceil( 1.05 ) = 2
ceil( -1.05 ) = -1
****************************************************************************/
}
Related Information