Home >>C Math Functions >C math floor() function
The C math floor() function is used to return the largest integer value less than or equal to given input number x. It takes a single argument and returns the value in type double. It is defined in <math.h> header file.
Syntax:double floor(double x)
x It is the floating point value.
Here is an example of floor() function:
#include <stdio.h>
#include <math.h>
int main ()
{
float val;
val = 1.65;
printf("Value = %.1lf\n", floor(val));
return(0);
}
#include <stdio.h>
#include <math.h>
int main ()
{
float val;
val = 13.39462;
printf("Value = %.1lf\n", floor(val));
return(0);
}