C 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 c.


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 c.

#include<stdio.h>

int main() {

  int n, i, a;

  printf("Enter a number:");
  scanf("%d", &n);

  printf("List in descending order:");

  for (i = n - 1; i >= 0; i--) {
    a = 1 + i * 2;
    printf("%d ", a);
  }

  return 0;
}

Output:

Enter a number:10                                                                                                                      
List in descending order:19 17 15 13 11 9 7 5 3 1