Even Odd Program

Even Odd Program

Even numbers are those which are divisible by 2. Numbers like 2,4,6,8,10, etc are even.

Odd numbers are those which are not divisible by 2. Numbers Like 1, 3, 5, 7, 9, 11, etc are odd.

Logic:

  • Take a number.
  • Divide it by 2.
  • If the remainder is 0, print number is even.

Even Odd Program in PHP

A program to check 1233456 is odd or even is shown.

Example:

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

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments