Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - About the division and rounding of C language! ?
About the division and rounding of C language! ?
Function name: ceil

Working energy: rounding

Usage: double ceil (double x);

Function Name: Floor

Working energy: rounding down

Usage: double floor (double X);

In addition, (int) (expression) rounds down the result of [expression].

Here's an example:

# include & ltstdio.h & gt

# include & ltmath.h & gt

int main(void){

int x = 1 1;

int y=0,z = 0;

Double a= 12.69, b=0.0, c = 0.0.

y = x/3;

z =(int)a;

B = floor (a);

c = ceil(a);

printf("\n \t y = %d \n ",y); // y = 3

printf("\n \t z = %d \n ",z); // z = 12

printf("\n \t b = %5.2lf ",b); // b = 13.00

printf("\n \t c = %5.2lf ",c); // c = 12.00

Returns 0;

}