floor C · 数学函数
向下取整,返回不大于参数的最大整数。
怎么用
double r = floor(数);
小例子
#include <stdio.h>
#include <math.h>
int main(void) {
printf("%f", floor(3.8));
return 0;
}
运行结果
输出 3.000000
提醒:像地板,只舍不入;头文件是 math.h
在代码里遇到不认识的词?打开代码点读机,点一下就懂 → ← C全部词条