Syntax
#include <math.h> double floor(double x);Description
floor calculates the largest integer that is less than or equal to x.
floor returns the floating-point result as a double value.
The result of floor cannot have a range error.
This example assigns y value of the largest integer less than or equal to 2.8 and z the value of the largest integer less than or equal to -2.8.
#include <math.h> int main(void) { double y,z; y = floor(2.8); z = floor(-2.8); printf("floor( 2.8 ) = %lf\n", y); printf("floor( -2.8 ) = %lf\n", z); return 0; /**************************************************************************** The output should be: floor( 2.8 ) = 2.000000 floor( -2.8 ) = -3.000000 ****************************************************************************/ }Related Information