+ 4
What is the syntax of this code and also find what is the error in this code
for(int i= ; i<=5; i++){ for(int a=1; a<=i; a++){ System.out.print("1"); } System.out.println(); }
1 Answer
+ 1
Error: Missing initializer for i in the first for loop. It should probably be for(int i=1;i<=5;i++).
Aa for the syntax, it's a nested for loop. For every value of i in the outer for loop, the inner loop is executed i times