-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod51
More file actions
34 lines (30 loc) · 811 Bytes
/
mod51
File metadata and controls
34 lines (30 loc) · 811 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
31
32
33
34
package dz51;
public class Arreymaxmin {
public static void main(String[] args) {
int[] Arrey_mn = {10, 5, 3, 2, 6, 20, 7, 4};
int max = 0, min = Arrey_mn[0];
for (int i = 0; i < 8; i++) {
if (Arrey_mn[i] < max) {
max = max;
} else {
max = Arrey_mn[i];
}
if (Arrey_mn[i] > min) {
min = min;
}
else {
min = Arrey_mn[i];
}
}
for (int i = 0; i < 8; i++) {
if (Arrey_mn[i] > min) {
min = min;
}
else {
min = Arrey_mn[i];
}
}
System.out.println("Max number " + max);
System.out.println("Min number " + min);
}
}