wenbao与取整函数
1 #include <stdio.h> 2 #include <math.h> 3 4 int main(){ 5 double number=123.54; 6 double down,up; 7 down=floor(number); 8 up=ceil(number); 9 printf("original_number%10.2lf\n",number); 10 printf("number_rounded_down%10.2lf\n",down); 11 printf("number_rounded_up%10.2lf\n",up); 12 return 0; 13 } 14 运行结果: 15 original_number 123.54 16 number_rounded_down123.00 17 number_rounded_up124.00
只有不断学习才能进步!