Ceil is the "ceiling"
The floor is a "floor" top-up value, and the other bottom-up value, like a ceiling, floor.
Double floor (Double X );
Double Ceil (Double X );
Use the floor function.
Floor (x) returns the largest integer less than or equal to X.
For example, floor (10.5) = 10 floor (-10.5) =-11
Use the ceil function.
Ceil (x) returns the smallest integer greater than X.
For example, Ceil (10.5) = 11 Ceil (-10.5) =-10
Floor () is an integer down, floor (-10.5) =-11;
Ceil () is rounded up, Ceil (-10.5) =-10
Ceil (x) returns the smallest integer not less than X (then converted to double type ).
Floor (x) returns the maximum integer not greater than X.
Round (x) returns x rounded to an integer.
# Include <stdio. h>
# Include <math. h>
Int main (INT argc, const char * argv [])
{
Float num = 1.4999;
Printf ("Ceil (% F) is % F \ n", num, Ceil (Num ));
Printf ("floor (% F) is % F \ n", num, floor (Num ));
Printf ("round (% F) is % F \ n", num, round (Num ));
Return 0;
}
Ceil (1, 1.499900) is 2.000000
Floors (1.499900) is 1.000000
Round (1.499900) is 1.000000