请问大佬们为啥只有80分?!

B2016 浮点数向零舍入

forhe @ 2023-10-15 23:34:54

#include<stdio.h>
int main()
{
    double a;
    int b;  
    scanf("%lf",&a);
    b=a/1;
    printf("%d",b);
    return 0;
}

by FurippuWRY @ 2023-10-16 00:06:43

double a;
scanf("%lf",&a);
printf("%ld",(long long)a);

by tongtong2012 @ 2023-11-04 20:48:38

@FurippuWRY 神奇!大佬求解释,本蒟蒻也有此问题~


by FurippuWRY @ 2023-11-04 20:53:55

@tongtong2012 相当于输出浮点数的整数位


by tongtong2012 @ 2023-11-04 20:55:58

哦~谢谢大佬!互关


by 123ytq666 @ 2024-01-13 10:44:51

要用long long


|