-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMinMax14.java
More file actions
28 lines (24 loc) · 595 Bytes
/
MinMax14.java
File metadata and controls
28 lines (24 loc) · 595 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
package minmax;
import java.util.Scanner;
public class MinMax14 {
public static void main(String[] args) {
int b;
int r;
int min = 0;
int minnum = 0;
Scanner scanner = new Scanner(System.in);
System.out.println("B:");
b = scanner.nextInt();
for (int i = 1; i <= 10; ++i) {
System.out.print(i+".");
r= scanner.nextInt();
//
if ((r > b) && ((r < min) || (minnum == 0)))
{
min = r;
minnum = i;
}
}
System.out.printf("%d %d\n",minnum,min);
}
}