C# program to print n Odd Natural Numbers
Program
using System;
namespace PrintNOddNaturalNumber
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter the value of n to print odd numbers till:\t");
int n = int.Parse(Console.ReadLine());
int i;
for(i = 1; i <= n; i++)
{
if((i % 2) != 0)
{
Console.Write("{0}\t", i);
}
}
}
}
}
Output
Enter the value of n to print odd numbers till: 10
1 3 5 7 9