2397 求最大值

#include<bits/stdc++.h>
#define f(i,s,e) for(int i = s; i <= e; i++)
#define ll long long
using namespace std;
const int N = 1e3+10,inf = 0x3f3f3f3f;

int main()
{
    int n,maxx = 0; //设maxx是最大值,初始化要较小
    for(int i = 1; i <= 5; i++) //循环5次
    {
        int x; cin >> x; //每次循环都输入一个数字x
        if(x > maxx) //如果x比最大值maxx要大
            maxx = x; //那么把x赋值给maxx,就可以更新最大值maxx了     
    } 
    //循环结束后输出maxx,就可以知道5个数字的最大值是多少了 
    cout << maxx;
    return 0;
}

 

posted @ 2024-06-28 17:51  CRt0729  阅读(2)  评论(0编辑  收藏  举报