0

What is error in this?

import java.util.*; class Ans{ public static void main(String[] args){ Scanner s = new Scanner(System.in); int[] z = new int[10]; for(int i = 0;i<z.length;i++){ System.out.println("Print the value of z["+i+"]"); z[i] = s.nextInt(); } for(int i = 0;i<z.length;i++){ System.out.println("The value of z["+i+"] is "+z[i]); } } } https://code.sololearn.com/cLqPB3w1NwBA/?ref=app

27th May 2020, 9:15 AM
Harsh Vyas
Harsh Vyas - avatar
3 Answers
0
There is no error. Just take input like this 0 1 2 3 4 5 6 7 8 9 Sololearn doesn't support multiple input inside loop if it is not of fixed size. Your loop should be of fixed size. https://code.sololearn.com/WhiNb9BkJUVC/?ref=app
27th May 2020, 9:17 AM
AÍąJ
AÍąJ - avatar
0
No there is something missing in this code
27th May 2020, 9:29 AM
Harsh Vyas
Harsh Vyas - avatar
27th May 2020, 7:41 PM
zemiak