Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

how to check if a number is even in c#

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();
 
PREVIOUS NEXT
Tagged: #check #number
ADD COMMENT
Topic
Name
4+4 =