在math.h中包含了下面的函数可以使用其中ceil向上取整,floor向下取整。fmod用于求余数. #i nclude "math.h" double ceil( double x ); The ceil function returns a double value representing the smallest integer that is greater than or equal to x. There is no error return. double floor( double x ); The floor function returns a floating-point value representing the largest integer that is less than or equal to x.There is no error return. double fmod( double x, double y ); fmod returns the floating-point remainder of x / y. If the value of y is 0.0, fmod returns a quiet NaN. For information about representation of a quiet NaN by the printf family, see printf.