#include<stdio.h>int main(){int i,j,temp;float sum = 0, avg=0,a[10];for (int i = 0; i < 10; i++){scanf("%f",&a[i]);}//冒泡排序,将最小值冒泡到下标为0的位置for (int i = 0; i < 10; i++){for (int j = 0; j < 10-i-1; j++){if (a[j]>a[j + 1]){temp = a[j + 1];a[j + 1] = a[j];a[j] = temp;}printf("%3.2f ", a[j]);}printf("\n");}printf("冒泡后的排序:");for (int i = 0; i < 10; i++){printf("%3.2f ", a[i]);}a[0] = a[9] = 0;// 19 18 17 16 15 14 13 12 11 10printf("\n");for (int i = 0; i <10; i++){printf("%3.2f ",a[i]);sum += a[i];}//总数减去最大最小值avg = sum / 10;printf("平均分是%3.2f分",avg);return 0;}
如果觉得《十个评委打分 去掉最高分和最低分 求平均分》对你有帮助,请点赞、收藏,并留下你的观点哦!