import java.util.Scanner;
public class JavaTestBank_45 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] a = new int[10];
for (int i = 0; i < 10; i++) {
a[i] = sc.nextInt();
}
int m = 1;
int min = a[1];
for (int j = 2; j < a.length; j++) {
if (a[j] < min) {
min = a[j];
m = j;
}
}
if (min < a[0]) {
int temp = a[m];
a[m] = a[0];
a[0] = temp;
}
int n = 1;
int max = a[1];
for (int j = 2; j < a.length - 1; j++) {
if (a[j] > max) {
max = a[j];
n = j;
}
}
if (max > a[a.length - 1]) {
int temp = a[n];
a[n] = a[a.length - 1];
a[a.length - 1] = temp;
}
for (int x : a) {
System.out.print(x + " ");
}
}
}
0.0分
1 人评分
程序员的表白 (C语言代码)浏览:706 |
A+B for Input-Output Practice (V) (C语言代码)浏览:640 |
C语言训练-尼科彻斯定理 (C语言代码)浏览:509 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:648 |
C语言程序设计教程(第三版)课后习题10.4 (C语言代码)浏览:583 |
a+b浏览:452 |
复数求和 (C语言代码)浏览:995 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:494 |
敲七 (C++代码)浏览:1119 |
C语言程序设计教程(第三版)课后习题10.2 (C语言代码)浏览:560 |