by CodeChum Admin
Instructions:
Input
The first line contains the size of the array/list.
The next lines contains an integer on each.
5
5
34
3
23
10
Output
A line containing an integer.
34
import java.util.Scanner;
import java.util.Random;
public class BigOne {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
Random r = new Random();
int max = 0, n = s.nextInt();
for (int i = 0; i < n; i++) {
int x = r.nextInt();
if (max > x) max = x;
}
System.out.println(max);
}
}
Comments
Leave a comment