+ 1
Why this program show "no output"????
7 Antworten
+ 1
1. Line 18 says System.out.println() so it doesnt print anything.
2. The if statement is outside for loop(with var j), so it will verify if c ==2 only at the end of that loop.
3. Please, use code identation, so the code can be more readable and clear.
If you dont understand something, just ask✌
+ 1
Here I explained some stuff:
https://code.sololearn.com/cjQT4UDLYL5c/?ref=app
+ 1
Lεd10 Dεda thnxzzzzz
+ 1
Glad to help✌
+ 1
Lεd10 Dεda nd also i want to ask that In my code i correct my mistake by taking c variable under outer loop so it wll work
but the question why it is not working outside ????
+ 1
If you declare int c = 0; outside the loops, it wont be 0 for every number i, like you want. So c == 2 will happen just one time or never.
0
Lεd10 Dεda i want to print prime number between 1 to 100