I have written a code that is generating random numbers based on user input. For example, if the user says they want the program to generate 3 random digits for them, and they want it to do it 3 times, the output will look like this:
1 4 5
2 6 5
3 4 5
The code that I've written would display this as:
1
4
5
2
6
5
3
4
5
How do I make them display as 3 numbers wide? Here's my code:
if (gameType == 3)
//for loop to generate random numbers
for (int i = 1; i <=numGames; i = i + 1){
for(int j = 1; j <= numGames * 3; j = j + 1 ){
ranNums = randomGenerator.nextInt(9);
//Print random numbers to user
System.out.println(ranNums);
As always, thank you! - I added to the post to help you understand more of what I need. Please let me know if you require more info to help me!
Aucun commentaire:
Enregistrer un commentaire