标签:scanf nbsp main 整型 return 要求 oat 4.0 include
1)#include <stdio.h>
int main()
{
int a,b,c,d,Sum;
float Average;
scanf("%d%d%d%d",&a,&b,&c,&d);
Sum = a + b + c + d;
Average = Sum / 4.0;
printf("Sum = %d",Sum);
printf("Average = %.1f",Average);
return 0;
}
average的输出若=2.0,是sum / 4
输出要求=2.5,需要sum / 4.0
!@#整型运算结果是整数
标签:scanf nbsp main 整型 return 要求 oat 4.0 include
原文地址:https://www.cnblogs.com/huanshang/p/9905378.html