ceilf
Round to smallest integral value not less than x
Description
The ceil function returns the smallest integral value greater than or equal to x.Example:
Example - Round to smallest integral value not less than x
Workings
#include <stdio.h> #include <math.h> int main(void) { for(double a = 12; a < 13; a += 0.1) printf("ceil of %.1lf is %.1lf\n", a, ceil(a)); return 0; }
Solution
Output
ceil of 12.0 is 12.0 ceil of 12.1 is 13.0 ceil of 12.2 is 13.0 ceil of 12.3 is 13.0 ceil of 12.4 is 13.0 ceil of 12.5 is 13.0 ceil of 12.6 is 13.0 ceil of 12.7 is 13.0 ceil of 12.8 is 13.0 ceil of 12.9 is 13.0 ceil of 13.0 is 13.0