Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
import java.util.Random;
public class Demo {
private static final Random r = new Random();
public static void main(String[] args) {
int val = 5;
while (val<= 100) {
System.out.printf("%-4d", r.nextInt(20) * 1);
if (val % 5 == 0) {
System.out.println();
}
val++;
}
System.out.println();
val = 20;
while (val<= 100) {
System.out.printf("%-4d", r.nextInt(10 * (20)));
if (val % 5 == 0) {
System.out.println();
}
val++;
}
}
}
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more