10.4k views
21 votes
Write a program using a for loop, to display number 20 to 10 in descending order

User Christner
by
3.0k points

1 Answer

7 votes

Answer:

public class MyProgram {

public static void main(String[] args) {

for (int i = 20; i >= 10; i--){

System.out.println(i);

}

}

}

Step-by-step explanation:

Since we are printing in descending order, we start with an initial value of 20, keep decrementing counter by 1 (the i-- part) until i reaches 20

User Keso
by
3.6k points