浮点数

#include<stdio.h>
int main()
{
    double a,b,c,d;
    a=6+5/4-2;
    b=2+2*(2*2-2)%2/3;
    c=10+9*((8+7)%6)+5*4%3*2+3;
    d=1+2+(3+4)*((5*6%7/8)-9)*10;
    //scanf("6+5/4-2",&a);
    printf("%lf %lf %lf %lf",a,b,c,d);
    return 0;
}

5.000000 2.000000 44.000000 -627.000000    双精度输出

#include<stdio.h>
int main()
{
    int a,b,c,d;
    a=6+5/4-2;
    b=2+2*(2*2-2)%2/3;
    c=10+9*((8+7)%6)+5*4%3*2+3;
    d=1+2+(3+4)*((5*6%7/8)-9)*10;
    printf("%d %d %d %d",a,b,c,d);
    return 0;
}

5 2 44 -627

原文地址:https://www.cnblogs.com/lijianmin6/p/10315635.html