int i = 5;
if (i % 2 == 0)
{
// even
}
else
{
// odd
}
int num = 100;
if (num % 2 == 0){
Console.WriteLine($"{num} is an even number");
}
else if (num % 2 != 0){
Console.WriteLine($"{num} isn't an even number");
}
// wait before closing
Console.ReadKey();
// using modulo operator %
if(num%2 == 0){
Console.WriteLine("Number is even")
}else{
Console.WriteLine("Number is odd")
}
int x = 2;
if(x % 2 == 0){
Console.WriteLine("Is even");
}
else
{
Console.WriteLine("Is odd");
}
bool IsEven = ( number %2) == 0
bool IsOdd = ( number %2) == 1