如何在不舍入C的情况下削减无穷小数?

时间:2018-10-11 14:38:26

标签: c

#include <stdio.h>

int main(){
    int a,b,c,d,e,f;
    float resulta, resultb, resultc,aa,bb,cc;

    scanf("%d\n%d\n%d", &a,&b,&c);
    resulta = (float)a/999;
    resultb = (float)b/999;
    resultc = (float)c/999;
    printf("%.3f...\n%.3f...\n%.3f...\n", resulta,resultb,resultc);
    return 0;
}

如果我在变量之一中输入998,它将创建为0,998998998998998998 ......

如何将其降低到0.998而不是0.999?

0 个答案:

没有答案