Can anyone please explain why this code does not produce output | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone please explain why this code does not produce output

public class Program { public static void main(String[] args) { for(int x = 20; x <=10; x--) { System.out.println(x); } } }

8th May 2018, 8:30 AM
Nasir
Nasir - avatar
1 Answer
+ 2
x=20 and is higher than 10, so x<=10 is false, try x>=10
8th May 2018, 8:40 AM
rafal