#include <stdio.h>int main(){ int score[10]={67,98,75,63,82,79,81,91,66,84}; int b; for(b=0;b<9;b++) score[b+1]+=score[b]; printf("平均分%d:\n",score[9]/10); int max; int i; for(i=0;i<9;i++) if(score[i]>max) max=score[i]; { printf("最大值%d:\n",max); } int min; int j; for(j=0;j<9;j++); if(score[j]<min); min=score[j]; { printf("最小值%d:\n",min); } int a; for(a=0;a<9;a++) score[a+1]+=score[a]; printf("总分%d:\n",score[9]); int x , y , z ; for(x = 0 ; x < 9 ; x++) { for(y = 0 ; y < 9 - x ; y++ ) if(score[y] > score[y + 1]) { z = score[y] ; score[y] = score[y + 1] ; score[y + 1] = z ; } } printf("考试成绩降序如下:\n") ; for(y = 0 ; y <10 ; y++ ) { printf("%d " , score[y] ) ; } return 0 ; }
2 回答
qq___524
TA贡献171条经验 获得超74个赞
#include <stdio.h> int main() { int score[10]={67,98,75,63,82,79,81,91,66,84}; int b, sum = 0; for(b=0;b<9;b++) sum += score[b]; printf("平均分%d:\n",sum/10); int max = 0; int i; for(i=0;i<9;i++) if(score[i]>max) max=score[i]; printf("最大值%d:\n",max); int min = 100; int j; for(j=0;j<9;j++) if(score[j]<min) min=score[j]; printf("最小值%d:\n",min); int a; sum = 0; for(a=0;a<9;a++) sum+=score[a]; printf("总分%d:\n",sum); int x , y , z ; for(x = 0 ; x < 9 ; x++) { for(y = 0 ; y < 9 - x ; y++ ) if(score[y] > score[y + 1]) { z = score[y] ; score[y] = score[y + 1] ; score[y + 1] = z ; } } printf("考试成绩降序如下:\n") ; for(y = 0 ; y <10 ; y++ ) { printf("%d " , score[y] ) ; } return 0 ; }
- 2 回答
- 0 关注
- 1446 浏览
添加回答
举报
0/150
提交
取消