C examples for math.h:ceil
function
<cmath> <ctgmath> <math.h>
Round up value
long double ceill (long double x); long double ceil (long double x); double ceil (double x); float ceilf (float x); double ceil (double x); float ceil (float x); double ceil (T x);
Parameter | Description |
---|---|
x | Value to round up. |
The smallest integral value that is not less than x.
#include <stdio.h> #include <math.h> /* ceil */ int main ()/*w w w . ja v a2 s . co m*/ { printf ( "%.1f\n", ceil(2.1) ); printf ( "%.1f\n", ceil(3.9) ); printf ( "%.1f\n", ceil(-2.1) ); printf ( "%.1f\n", ceil(-3.9) ); return 0; }