计算平均分

/* 功能:计算平均分 日期:2013-04-01 */ #include<stdio.h> #include<stdlib.h> #include<math.h>

int main(void) { double one,two,three,four,five,max,min,average; printf("请输入5位评委所打的成绩:"); scanf("%lf,%lf,%lf,%lf,%lf",&one,&two,&three,&four,&five);

max = min = one //求最大值 max = max>two?max:two; max = max>three?max:three; max = max>four?max:four; max = max>five?max:five; //求最小值 min = min<two?min:two; min = min<three?min:three; min = min<four?min:four; min = min<five?min:five; //求平均值 average =(one + two + three + four + five - max - min) / 3;

printf("该选手的平均得分是:%.1lfn",average); system("pause");

return 0; }

______________________________________________________________________________

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

扫码关注云+社区

领取腾讯云代金券