Untitled
unknown
csharp
2 years ago
564 B
11
Indexable
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
}
}
Editor is loading...
Leave a Comment