fork download
  1. <?php
  2.  
  3. /*This is my first PHP lab01*/
  4. $n=100;
  5. $i=0;
  6. $s=0;
  7. echo("Please enter value fon N\n");
  8. $n=(int)readline(20);
  9. $s=0;
  10. for($i=1;$i<=$n;$i+=1)
  11. {
  12. if($i % 2 == 0)
  13. {
  14. $s=$s+$i;
  15. echo("Current value i=".$i."S=".$s);
  16. echo("\n");
  17. }
  18. }
  19. echo("Final result suma is S=".$s);
  20. ?>
Success #stdin #stdout 0.02s 26148KB
stdin
Standard input is empty
stdout
Please enter value fon N
Final result suma is S=0