ZZULIOJ1020: 两整数排序

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u014543872/article/details/83511988

[提交] [状态] [讨论版] [命题人:admin]

题目描述

从键盘输入两个整数x,y,按从小到大的顺序输出它们的值。 

输入

输入两个整数x,y。 

输出

按从小到大的顺序输出它们的值。数据之间以空格间隔。 

样例输入

20 16

样例输出

16 20
import java.util.Scanner;

public class Dome1 {
	public static void main(String[] args) {

		Scanner input = new Scanner(System.in);

		int x = input.nextInt();
		int y = input.nextInt();
		if (x > y) {
			System.out.println(y + " " + x);
		} else {
			System.out.println(x + " " + y);
		}
	}
}

猜你喜欢

转载自blog.csdn.net/u014543872/article/details/83511988