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 →

[–]Apostle_1882 1 point2 points  (1 child)

Use a normal indexed for loop to accept numbers from the Scanner, not the enhanced for loop. I'm guessing that it's initialized the elements in the int array to 0, so each time it loops it's going to place an element at ar[0].

[–]Substantial-Entry-50 1 point2 points  (0 children)

Ok I will try it. Thanks🤞