What is the syntax of this code and also find what is the error in this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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(); }

12th Oct 2018, 5:01 AM
A.K Maurya
A.K Maurya - avatar
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
12th Oct 2018, 5:29 AM
fra
fra - avatar