Computer Science, asked by ayush788186, 1 year ago

write a program in php generate first 20 natural numbers?

Answers

Answered by siddhartharao77
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
siddhartharao77: Welcome, sir!
Answered by omegads03
0

{

  n=i;

 for n=0; n<20; n++;

  printf("\n The number is \n");

  getch();

}

Similar questions