Jump to content

How can I make too different PHP programs that capture the following?


crodbos

Recommended Posts

1-   Write a PHP program that goes through all integers between 1 and 100 (excluding 1 and 0) and displays each even number on a separate line.

 

2- Re-write the program in question 1 but this time use a function to go through the numbers and display them.

 

I have the following.  How can I do the other one?    :'(

 

<?php

 

for ($i = 2; $i <= 100; $i++)

{

if ($i % 2 == 0){

print $i . " <Br>

";

}

}

 

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.