0

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:

4
Contributors
3
Replies
4
Views
10 Years
Discussion Span
Last Post by MacGyver Orca
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.