How do you do this? I can assign each random values into arrays, but I cannot increment the value so that I can display each values with another for loops. It needs to be 5 to the right..

import java.util.Scanner;
import java.util.Random;
public class LabAssgn_laksmono
{
public static void main(String args[])
{
Scanner input = new Scanner(System.in);
Random r = new Random();
int user;
do
{
System.out.print("Enter input between 10 to 100: ");
user = input.nextInt();
}
while(user > 100 || user < 10);
int array[] = new int [user];
int values;
for(int i = 0 ; i < array.length ; i++)
{
values = r.nextInt(100) + 1;
array[i] = values;
for (int j = 1; j <= 5; j++)
{
System.out.printf("%d ", values);
}
System.out.println();
}
}
}

thanx for the help... :sad:

WHAT can't you do?
Either you don't know what you're trying to do or you can't explain it to someone else.

Please explain what you expect to see as output, and what you are seeing as output, as well as what was provided as input.

Also, post any exceptions you may be getting.

Why don't you just include a print statement inside the for loop where you assign the random values?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.