floor() in C

floor() returns the largest integral value that is not greater than its argument. The return type is double.

Syntax Top ↑

double floor(double x);

Example 1 Top ↑

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

int main(void) {
    double value = 5.8;

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

Example 2 Top ↑

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

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

    printf("floor(-5.2): %.1f\\n", floor(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