Hi,
I'm new to this Forum. I need to find the correct answers for following questions.
Exercise:
write down PHP code to print all ODD numbers between 0 and 100.
a) Using for loop
b)Using while loop
Exercise:
Define a PHP function to get a positive integer as input as input parameter and to return the sum of all integers from 1 up to that number
iroshw@live.com
Irosh
Need a help - PHP cording (for my exercise)
Moderator: General Moderators
Re: Need a help - PHP cording (for my exercise)
We're not going to do your homework for you. What have you written so far? Where are you running into trouble?
Re: Need a help - PHP cording (for my exercise)
Try this
while loop
for loop
while loop
Code: Select all
<?php
$Count = 1;
while ($Count < 100) {
echo "$Count ";
$Count = $Count+1;
}
?>
Code: Select all
<?php
for ($i = 1; $i < 100; $i++) {
echo $i;
}
?>