输入一批学生的成绩(整数),输出最高分。

# include<stdio.h>
int main()
{
	int score,max=0;
	while(score>=0)
	{
		scanf("%d",&score);
		if(score>max)
		{
			max=score;
		}
	}
	printf("%d",max);
	return 0;
}

采取while if嵌套结构,外层判断是否结束,内层判断最大值是否改变。

发布了15 篇原创文章 · 获赞 1 · 访问量 244

猜你喜欢

转载自blog.csdn.net/Du798566/article/details/104185154