Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Check Odd or Even

From Groundhog Learning
Revision as of 15:51, 21 October 2025 by Groundhog (talk | contribs) (Updated via bot)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

You can use the modulo operator to check if a number is divisible by 2.

Check Odd or Even in C#

💻 C#

int number = 7
if (number % 2 == 0)
{
    // number is even
}
else
{
    // number is odd
}

Related Concepts