25.一大一小

33 阅读1分钟

链接:ac.nowcoder.com/acm/problem…
来源:牛客网

题目描述

输入两个整数X,Y,通过交换将大的数放在X中,小的数放在Y中。

输入描述:

输入一行,包含两个整数X,Y

输出描述:

输出两行,每行一个整数,输出交换后的X, Y

示例1

输入

4 5

输出

5
4

代码

#include <bits/stdc++.h>

using namespace std;

int main(){
    int x,y;
    cin >> x >> y;
    if(x < y){
        int num = x;
        x = y;
        y = num;
    }
    cout << x << endl;
    cout << y << endl;
    return 0;
}