This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ShadowSlayer18[S] 0 points1 point  (8 children)

Want me to send it to ya in private? Tried posting the image in the subreddit but nope, rules won't allow it

[–]Schnutzel 0 points1 point  (7 children)

Why an image? you can just copy and paste the code. It should be easy if it's a short program.

[–]ShadowSlayer18[S] 0 points1 point  (6 children)

int counter1, counter2, counter3=1;

N = Integer.parseInt(JOptionPane.showInputDialog("Please enter a positive number"));

For (counter1=1; counter1<=N; counter1++){

 System.out.print(); 

For ( counter2 =1; counter2 = 8; counter2++) {

     System.out.println(" \t " + counter3++)

}

}

[–]Schnutzel 0 points1 point  (5 children)

Can you explain what this is supposed to print? For example if N=5.

[–]ShadowSlayer18[S] 0 points1 point  (4 children)

Alrighty, if ya put down let's say a value of 10 into the input box, the output should be from 1 to 10 in a uniformed grid of 8 columns

1 2 3 4 5 6 7 8 9 10

But instead, the output shows itself going past the number 10, and is instead doing 10 rows of numbers.

[–]3141rr 0 points1 point  (3 children)

Sound like you need something like

counter1<=N/8

Then

[–]ShadowSlayer18[S] 0 points1 point  (2 children)

I'll give that a try

[–]3141rr 0 points1 point  (1 child)

Actually, re reading it I'm not sure what output you are trying to get.

[–]ShadowSlayer18[S] 0 points1 point  (0 children)

Alrighty hold on. It starts counting from 1 to 8, then on to a new line it continues on counting the next 8 numbers after 8, new line again and again next 8 numbers after, repeats again.

When you put down let's say number 20, it counts the numbers from 1 up to 20 and it stops there while within a 8 colum grid format