even numbers and odd numbers c# code example
Example 1: check if number is even or odd c#
int i = 5;
if (i % 2 == 0)
{
// even
}
else
{
// odd
}
Example 2: odd or even in c#
if(num %2 == 0){
Console.WriteLine("Number is even")
}else{
Console.WriteLine("Number is odd")
}