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#.
10 => 19 17 15 13 11 9 7 5 3 1
Example: How to print first n odd numbers in descending order in C#.
using System;
public class Program
{
public static void Main(string[] args)
{
int n, i, a;
Console.Write("Enter How many number:");
n = Convert.ToInt32(Console.ReadLine());
Console.Write("List is:");
for (i = n - 1; i >= 0; i--)
{
a = 1 + i * 2;
Console.Write(" " + a);
}
}
}
Output:
Enter How many number:5
List is: 9 7 5 3 1