Java Program to Print First 10 Natural Numbers in Reverse

Write a Java program to print first 10 natural numbers in reverse order using for loop.

package NumPrograms;

public class First10NaturalNumRev1 {

	public static void main(String[] args) {
		
		System.out.println("The First 10 Natural Numbers in Reverse");
		for(int i = 10; i >= 1; i--) 
		{
			System.out.println(i);
		}
	}
}
Java Program to Print First 10 Natural Numbers in Reverse

Java program to print the first 10 natural numbers in reverse order using a while loop.

package NumPrograms;

public class First10NaturalNumRev2 {

	public static void main(String[] args) {
		
		int i = 10;
		
		System.out.println("The First 10 Natural Numbers in Reverse");
		while( i >= 1) 
		{
			System.out.println(i);
			i--;
		}
	}
}
The First 10 Natural Numbers in Reverse
10
9
8
7
6
5
4
3
2
1

This Java example displays the first 10 natural numbers in the reverse or descending order using the do while loop.

package NumPrograms;

public class First10NaturalNumRev3 {

	public static void main(String[] args) {
		
		int i = 10;
		
		System.out.println("The First 10 Natural Numbers in Reverse");
		
		do 
		{
			System.out.println(i);

		} while(--i >= 1);
	}
}
The First 10 Natural Numbers in Reverse
10
9
8
7
6
5
4
3
2
1