+ 1
For loop in java not working
A basic program in java using for loop not working https://code.sololearn.com/cyhji4Tu1joS/?ref=app
3 Answers
+ 9
Bro remove ";" after the condition of for loop.
public class Program
{
public static void main(String[] args) {
for(int j=1;j<=10;j++)
{
System .out.println (j);
}
}
}
+ 3
It doesn't work because at the end of the for loop you used a semicolon, and that confused the program
for (int j = 1; j <= 10; j++); <- here
{
System.out.println(j);
}
+ 1
Please don't spam the post 2 times
https://www.sololearn.com/Discuss/1316935/?ref=app