1163028233 发表于 2020-12-17 23:08:37

printf的输出问题

#include<stdio.h>
int main()
{
    int a, b;
    double c = 0.0;
    scanf("%d %d", &a, &b);
    printf("input two numbers \n");
    printf("%d + %d = %d\n", a, b, a + b);
    printf("%d - %d = %d\n", a, b, a - b);
    printf("%d * %d = %d\n", a, b, a * b);
    c = a * 1.0 / (b *1.0);
    if (a % b == 0)
    {
      printf("%d / %d = %.f\n", a, b, c);
    }
    else
    {
      printf("%d / %d = %.2f\n", a, b, c);
    }

return 0;
}
我想问为什么
    printf("%d + %d = %d\n", a, b, a + b);
    printf("%d - %d = %d\n", a, b, a - b);
    printf("%d * %d = %d\n", a, b, a * b);
上面这三条为什么不会打印在终端上,而printf("input two numbers \n");这条会打印在终端上?

一世轻尘 发表于 2020-12-17 23:13:20

????

1163028233 发表于 2020-12-17 23:31:14

一世轻尘 发表于 2020-12-17 23:13
????

....   我犯傻了,突然明白了
页: [1]
查看完整版本: printf的输出问题