题解 | 实现四舍五入
#include<stdio.h>
#include <math.h> // 为了使用 round 函数
#define set(a) printf("%d\n",(int)round(b))
int main()
{
float b;
// 读取浮点数
scanf("%f", &b);
set(b);
return 0;
}
// 64 位输出请用 printf("%lld")
#include<stdio.h>
#include <math.h> // 为了使用 round 函数
#define set(a) printf("%d\n",(int)round(b))
int main()
{
float b;
// 读取浮点数
scanf("%f", &b);
set(b);
return 0;
}
// 64 位输出请用 printf("%lld")
相关推荐