write a program in php generate first 20 natural numbers?
Answers
Answered by
2
PHP to generate first 20 natural numbers:
For loop:
for($i = 1; $i<=20; $i++)
{
echo $i;
echo "<br>";
}
While loop:
while($i <= 20)
{
echo $i. '<br>';
$i = $i + 1;
}
Hope it helps!
rishilaugh:
thanks
Answered by
0
{
n=i;
for n=0; n<20; n++;
printf("\n The number is \n");
getch();
}
Similar questions