import java.util.Random;
import java.util.Scanner;
public class RandomNumber {
public static void main(String[] args) {
Scanner myScanner=new Scanner(System.in);
System.out.print("Enter how many random number do you want : ");
int n=myScanner.nextInt();
Random rn=new Random();
System.out.print("Enter highest length : ");
int h=myScanner.nextInt();
System.out.print(n+" random number up to between "+h+" is : ");
for (int i = 0; i < n; i++) {
System.out.print(rn.nextInt(h)+"\t");
}
}
}
//Enter how many random number do you want : 10
//Enter highest length : 100
//10 random number up to between 100 is : 16 46 98 65 38 64 52 48 38 36
import java.util.Scanner;
public class RandomNumber {
public static void main(String[] args) {
Scanner myScanner=new Scanner(System.in);
System.out.print("Enter how many random number do you want : ");
int n=myScanner.nextInt();
Random rn=new Random();
System.out.print("Enter highest length : ");
int h=myScanner.nextInt();
System.out.print(n+" random number up to between "+h+" is : ");
for (int i = 0; i < n; i++) {
System.out.print(rn.nextInt(h)+"\t");
}
}
}
//Enter how many random number do you want : 10
//Enter highest length : 100
//10 random number up to between 100 is : 16 46 98 65 38 64 52 48 38 36
No comments:
Post a Comment