Write a C# Console Application program to print even numbers between 1 to N using for loop.
C# Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | static void Main(string[] args) { Console.Write("Number : "); int number = Convert.ToInt32(Console.ReadLine()); for (int i = 1; i <= number; i++) { if(i%2==1) { Console.WriteLine(i); } } Console.ReadKey(); } |