+ 1

Why this code doesn't go?

I want to print this,using Array: 123 456 789 But there is an error: https://code.sololearn.com/cVWFP8s3iIoE/?ref=app It just prints first two numbers, why? Can anyone help me please?

25th Jun 2017, 2:37 PM
You don't know me
You don't know me - avatar
1 Odpowiedź
+ 3
Your nil=sc.nextLine(); is inside the for loop. So it wants 10 lines instead of 3. So when you type: 123 456 789 You'll get an error because you only gave 3 lines. Try getting the input from outside the loop and store them in an array.
25th Jun 2017, 2:44 PM
Limitless
Limitless - avatar