#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> int main() { int i,j,n,t,a[100]; int sum = 0,ping,you=0,liang=0,zhong=0,cha=0; printf("请输入n位同学的成绩:\n"); scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &a[i]); sum = sum + a[i]; } ping = sum/n; printf("这%d位同学的平均成绩为%d\n",n,ping); //气泡法 for(j=0;j<n-1;j++) for(i=0;i<n-1-j;i++) if (a[i] > a[i + 1]) { t = a[i]; a[i] = a[i + 1]; a[i + 1] = t; } printf("这%d位同学的最高分为%d\n", n, a[n-1]); printf("这%d位同学的最低分为%d\n", n, a[0]); for (i = 0;i<n; i++) { if (a[i] >= 90 && a[i] <= 100) printf("%d优秀\n",a[i]); else if (a[i] >= 75 && a[i] < 90) printf("%d优良\n",a[i]); else if (a[i] >= 60 && a[i] < 75) printf("%d中等\n",a[i]); else if (a[i] >= 0 && a[i] < 60) printf("%d差\n",a[i]); } return 0; }