Find odd or even number normal method
Program:
<?php
$num = 7;
if($num % 2 == 0)
{
echo $num . " is even.";
}
else
{
echo $num . " is odd.";
}
?>
Output:
Find odd or even number "Input"method
Program:
<?php
$num = readline("Enter a number: ");
if($num % 2 == 0)
{
echo $num . " is even.";
}
else
{
echo $num . " is odd.";
}
?>