输出样式
Rank Number Ratio
Excellent 684 3.0%
Good 3290 14.6%
Medium 7512 33.4%
Pass 10958 48.7%
Fail 37 0.2%
Total 22481 100.0%
我的代码
#include<stdio.h>
int main(void){ int Excellent,Good,Medium,Pass,
Fail;
scanf("%d%d%d%d%d",&Excellent,&Good,&Medium,&Pass,&Fail);
float a,b,c,d,e,h;
printf("Rank Number Ratio\n"); printf("-----------------------\n"); printf("Excellent%7d %.1f%%\n",Excellent,a=(float) Excellent/(Excellent+Good+Medium+Pass+Fail)*100); printf("Good%12d %.1f%%\n",Good,b=(float) Good/(Excellent+Good+Medium+Pass+Fail)*100); printf("Medium%10d %.1f%%\n",Medium,c=(float) Medium/(Excellent+Good+Medium+Pass+Fail)*100); printf("Pass%12d %.1f%%\n",Pass,d=(float) Pass/(Excellent+Good+Medium+Pass+Fail)*100); printf("Fail%12d %.1f%%\n",Fail,e=(float) Fail/(Excellent+Good+Medium+Pass+Fail)*100); printf("-----------------------\n"); printf("Total%11d %.1f%%\n",Excellent+Good+Medium+Pass+Fail,h=(float)(a+b+c+d+e)); return 0;}
结果报错:运行一样,格式错误,求解