Function name : floor
Header file : <math.h>
Function prototype : double floor(double x);
Function : round down
Parameters : double x is the double precision value to be operated on
Return value : Returns the largest integer represented by a double-precision floating point number <=x.
Program example : Find the rounding down of a floating point number and output the result
#include<stdio.h>#include<math.h>intmain(void){doublenumber=123.54;doubledown,up;down=floor(number);up=ceil(number);printf(originalnumber%10.2lfn, number);printf(numberroundeddown%10.2lfn,down);printf(numberroundedup%10.2lfn,up);return0;}
Running results:
originalnumber123.54numberroundeddown123.00numberroundedup124.00