Java Program to print first n odd numbers in descending order


In this program, You will learn how to print first n odd numbers in descending order in Java.


List of odd numbers in descending order : 11, 9 , 7, 5, 3, 1


Example: How to print first n odd numbers in descending order in Java

Run it Now
import java.util.Scanner;

class Main {
    public static void main(String args[]) {

        int i, n, a;

        Scanner sc = new Scanner(System.in);
        System.out.print("Enter a Number :");
        n = sc.nextInt();

        System.out.println("\nList of Odd Number In Descending Order:");
        for (i = n - 1; i >= 0; i--) {
            a = 1 + i * 2;
            System.out.println(a);
        }

    }
}

Output:

Enter a Number :10
List of Odd Number In Descending Order:
19
17
15
13
11
9
7
5
3
1