Online Snippets Library

Find Even Odd number Program in PHP

Even number are divisible by 2 and odd numbers are not divisible by 2. Example are given Below.

Example

<?php
$num=31;
if($num%2==0)
{
 echo "Even number"; 
}
else
{
 echo "Odd number";
} 
?>

Out Put

Odd number