- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask_232.java
More file actions
Latest commit
30 lines (25 loc) · 699 Bytes
/
Copy pathTask_232.java
File metadata and controls
30 lines (25 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
importjava.util.Scanner;
publicclassTask_232 {
publicstaticvoidmain(String[] args) {
Scanners = newScanner(System.in);
intn = s.nextInt();
int[] a = newint[n];
for (inti = 0; i < n; i++) {
a[i] = s.nextInt();
}
for (inti = 0; i < n - 1; i++) {
intposition = i;
for (intj = i; j < n; j++) {
if (a[j] < a[position]) {
position = j;
}
}
intx = a[position];
a[position]= a[i];
a[i] = x;
}
for (inti = 0; i < n; i++) {
System.out.print(a[i] + " ");
}
}
}