Untitled
using System; class Program { static void Main(string[] args) { int n = 10; // Change the value of 'n' to the desired range of numbers Console.WriteLine("Even numbers:"); for (int i = 0; i < n; i++) { if (i % 2 == 0) Console.Write(i + " "); } Console.WriteLine("\nOdd numbers:"); for (int i = 0; i < n; i++) { if (i % 2 != 0) Console.Write(i + " "); } Console.ReadLine(); // To keep the console window open } }
Leave a Comment