Q:

Even Odd Program in Php

0

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.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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";  
}   
?>  

Output:

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now