#include <iostream>
using namespace std;
int main() {
    int n,max=0;
    while (scanf("%d",&n)==1)
    //scanf返回值为int类型表示成功输入的数据数量个数
    {
        if(n>max)    max=n;
    }
    printf("%d",max);
    return 0;
}
    

C语言:

#include <stdio.h>
int main() {
    int n,max=0;
    while (scanf("%d",&n)==1)
    //scanf返回值为int类型表示成功输入的数据数量个数
    {
        if(n>max)    max=n;
    }
    printf("%d",max);
    return 0;
}
    

 


    

转载于:https://www.cnblogs.com/XUEYEYU/p/C-scanf.html

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐