Even Odd Program in PHP using For Loop

Even Odd Program in PHP using For Loop

In this article, you will learn Even Odd Program in PHP using For Loop

 <?php
echo "even no. are-" ." ";
for($i=1;$i<=100;$i++){
    if($i%2==0){
    echo '(' .$i .')' ." ";
    }
}
echo "<br>";
echo "odd no. are-" ." ";
for($i=0;$i<=100;$i++){
    if($i%2!=0){
    echo '['.$i.']' ." ";
    }
}
?>

In the above program using two loopings. One for using the Even number and second one using for Even number.

How to Use For Loop Statement in PHP

Leave A Reply