ceil() in C

ceil() returns the smallest integral value that is not less than its argument. The return type is still double.

Syntax Top ↑

double ceil(double x);

Example 1 Top ↑

#include <math.h>
#include <stdio.h>

int main(void) {
    double value = 5.2;

    printf("ceil(5.2): %.1f\\n", ceil(value));
    return 0;
}

Example 2 Top ↑

#include <math.h>
#include <stdio.h>

int main(void) {
    double value = -5.8;

    printf("ceil(-5.8): %.1f\\n", ceil(value));
    return 0;
}




plus2net.com






✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer