Isi array dengan angka acak antara 1 dan 100 java
import java.util.Scanner;
import java.util.Arrays;
public class RndArray{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int arrLength;
System.out.println("Enter your array's length");
arrLength = scan.nextInt();
int [] arr = new int [arrLength]; // between [] array's length
for(int i = 0 ; i<arrLength ; i++){
arr[i] = (int) (Math.random()*100 + 1);
}
System.out.println(Arrays.toString(arr));
}
}
Steven2003