将三个整数从小到大顺序输出
时间: 2024-02-01 13:03:45 浏览: 76
输入三个整数,按由大到小输出.c
以下是Java实现将三个整数从小到大顺序输出的代码:
```java
import java.util.*;
public class Test {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int a = scanner.nextInt(), b = scanner.nextInt(), c = scanner.nextInt();
int[] arr = {a, b, c};
Arrays.sort(arr);
System.out.println("a:" + arr[0] + " " + "b:" + arr[1] + " " + "c:" + arr[2]);
}
}
```
阅读全文