今天的程序又是哪里出现问题了呢a

img

img

img


我 本人,新得不能再新了,别骂,真的有在努力听课,就是有点晕😵热情还在


#include<stdio.h>

int main()
{
    double a, b;
    scanf("%lf %lf", &a, &b);
    double c = a + b;
    double d = a * b;

    printf("%.3lf %.3lf", c, d);

    return 0;
}

a和b是float类型,不能用%d输入,改为%f

都用float类型
float a, b, c, d;
scanf("%f %f", &a, &b);

题目中说的是读入两个实数,而不是整数,将int和float改成double,以及输入的时候格式说明为%lf
输出的时候也是一样,%.3lf

img