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: Difference between revisions

From Groundhog Learning
Updated via bot
 
(No difference)

Latest revision as of 15:51, 21 October 2025

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