Floor function returns the greatest integer not greater than x. For example if the input is 2.25 then output will be 2.00.
Declaration :- double floor(double x);
#include <stdio.h> #include <math.h> int main() { double n, result; printf("Enter a number to round it down\n"); scanf("%lf", &n); result = floor(n); printf("Original number = %.2lf\n", n); printf("Number rounded down = %.2lf\n", result); return 0; }
| Attachment | Size |
|---|---|
| 4.73 KB |
