Untitled

mail@pastecode.io avatar
unknown
csharp
2 months ago
564 B
3
Indexable
Never
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