ceil() returns the smallest integral value that is not less than its argument. The return type is still double.
double ceil(double x);#include <math.h>
#include <stdio.h>
int main(void) {
double value = 5.2;
printf("ceil(5.2): %.1f\\n", ceil(value));
return 0;
}#include <math.h>
#include <stdio.h>
int main(void) {
double value = -5.8;
printf("ceil(-5.8): %.1f\\n", ceil(value));
return 0;
}
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.