题目描述
给出三个整数 a,b,c(0≤a,b,c≤100),要求把这三位整数从小到大排序。
输入格式
输入三个整数 a,b,c,以空格隔开。
输出格式
输出一行,三个整数,表示从小到大排序后的结果。
输入输出样例
输入 #1
1 14 5
输出 #1
1 5 14
输入 #2
2 2 2
输出 #2
2 2 2
代码如下:
// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`,
// then press Enter. You can now see whitespace characters in your code.
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
int [] a=new int[3];
for(int i=0;i<3;i++) a[i]=scanner.nextInt();
Arrays.sort(a);
for(int i=0;i<3;i++) System.out.print(a[i]+" ");
}
}