从键盘上输入若干学生的成绩,统计并输出最高成绩和最低成绩和学生总成绩平均成绩和学生数,当输入负数时结束

#include 
int main()
{
	int score,max,min,sum=0,num=0;
	double	ave=0;
	printf("请输入若干学生的成绩,输入负数时结束:");
	scanf("%d",&score);
	max=min=score;
	while(score>=0)
	{
		num++;
		sum+=score;
		if(maxscore)   /*求最低分*/
			min=score;
		scanf("%d",&score);
	}
	ave=sum*1.0/num;
	printf("最高分为%d,最低分为%d,总分为%d,总共有%d个学生成绩,平均成绩为%lf",max,min,sum,num,ave);
}

你可能感兴趣的:(蓝桥杯,c语言,职场和发展)