fork download
  1. <?php
  2.  
  3. $h=2;
  4. echo "Prime numbers from 1 to 50 are :";
  5. echo "\n";
  6. while($n<=50){
  7. $c=0;
  8. for($i=1;$i<=$n;$i++)
  9. {
  10. if( $n%$i == 0){
  11. $c++;
  12. }
  13. }
  14. if($c==2){
  15. echo $n;
  16. echo "\n";
  17.  
  18. }
  19. $n++;
  20. }
  21. ?>
  22.  
Success #stdin #stdout #stderr 0.03s 25744KB
stdin
Standard input is empty
stdout
Prime numbers from 1 to 50 are :
2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
stderr
PHP Notice:  Undefined variable: n in /home/rMAF1s/prog.php on line 6
PHP Notice:  Undefined variable: n in /home/rMAF1s/prog.php on line 8
PHP Notice:  Undefined variable: n in /home/rMAF1s/prog.php on line 19