printf("floor(%f) is %f\n", num, floor(num)); printf("round(%f) is %f\n", num, round(num));return0; } 运行结果: ceil(1.499900)is2.000000floor(1.499900)is1.000000round(1.499900)is1.000000
ceil(x)返回不小于x的最小整数值(然后转换为double型)。 floor(x)返回不大于x的最大整数值。 round(x)返回x的四舍五入整数值。 代码: #include <stdio.h>#include<math.h>intmain(intargc,constchar*argv[]) {floatnum =1.4999; printf("ceil(%f) is %f\n", num, ceil(num)); printf("floor(%f...