Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Random rand = new Random();
- Scanner scan = new Scanner(System.in);
- int[] a1 = new int[10];
- int min = 1;
- int max = 100;
- int top = a1[0];
- System.out.print("Array: ");
- for(int x = 0; x< a1.length; x++){
- a1[x] = rand.nextInt(max-min + 1) + min;
- System.out.print(a1[x] + " ");
- }
- System.out.println(" ");
- for (int j = 0; j< a1.length; j++){
- if (a1[j]>top){
- top = a1[j];
- }
- }
- System.out.println("The largest value is: " +
- top );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement