Easy csharp

Check even or odd

Problem

Read an integer (use 42) and print whether it is even or odd.

Hints
  • Use the ternary operator or if/else with n % 2.

Your practice code

Ready — edit the code above and click Run.

Solution

using System;

class Program
{
    static void Main()
    {
        int n = 42;
        Console.WriteLine(n % 2 == 0 ? "Even" : "Odd");
    }
}

Try solving on your own first, then reveal the official answer.

Explanation

Modulo % 2 is zero for even numbers—common interview warm-up.

Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details