1059: 最高分

题目描述

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

输入

 输入包含多个非负整数和一个负整数。该负数不作为有效成绩,只表示输入结束。 

输出

 输出一个整数,即最高分。单独占一行。 

样例输入

 7 6 5 9 2 -1

样例输出

9

提示

 ...

来源

* 

#include<stdio.h> 
#include<limits.h>  //....tou  wenjian
 
 
int main() 

    int score, max; 
 
    max = INT_MIN; 
 
    while( scanf("%d", &score), score >= 0) //逗号表达式 
    { 
        if(score > max) 
            max = score; 
    } 
 
    printf("%d\n", max); 
    return 0; 

猜你喜欢

转载自www.cnblogs.com/binanry/p/9217292.html