# C floor Function

The C floor function is one of the Math Function, used to return the closest integer value, which is less than or equal to a given number. The syntax of the math floor in C Programming is

`double floor(double number);`

## C floor Function Example

The math floor Function allows you to find the closest integer value, which is less than or equal to a user given number. In this program, We are going to find same and display the output C Programming.

```/* FLOOR in C Programming Example */

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

int main()
{
printf("\n The Floor Value of 0.75    = %.2f ", floor(0.75));
printf("\n The Floor Value of 12.25   = %.2f ", floor(12.25));
printf("\n The Floor Value of 152.50  = %.2f ", floor(152.50));

printf("\n The Floor Value of -12.36  = %.2f ", floor(-12.36));
printf("\n The Floor Value of -27.82  = %.2f ", floor(-27.32));
printf("\n The Floor Value of -90.50  = %.2f ", floor(-90.50));

return 0;
}```

## math floor function Example 2

In this program, we used the floor function to find the closest number of the user-entered value.

```/* FLOOR in C Programming Example */

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

int main()
{
float number, floorValue;

printf(" Please Enter any Numeric Value :  ");
scanf("%f", &number);

floorValue = floor(number);

printf("\n The Floor Value of %.2f = %.4f ", number, floorValue);

return 0;
}```
`````` Please Enter any Numeric Value :  125.87

The Floor Value of 125.87 = 125.0000``````