Advertisement
tei123

Untitled

Oct 28th, 2016
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <html> <head>
  2. </head>
  3. <body>
  4. <?php
  5.  
  6. $tab = array(5);
  7. for ($i=0;$i<5;$i++)
  8. {
  9. $tab[$i]=rand(0,100);
  10. echo $tab[$i]." ";
  11. };
  12. echo '<br>';
  13. for ($i=4;$i>=0;$i--)
  14. {
  15. echo $tab[$i]." ";
  16. }
  17. echo '<br>';
  18. echo $tab[2];
  19. $s=0;
  20. $sn=0;
  21. for ($i=0;$i<5;$i++)
  22. {
  23. if($tab[$i]%2==0)
  24. $s=$tab[$i]+$s;
  25. else{
  26. $sn=1;
  27. $sn=$sn*$tab[$i];};
  28. }
  29.  
  30.  
  31. echo '<br>';
  32. echo $s;
  33. echo '<br>';
  34. echo $sn;
  35. echo '<br>';
  36. sort ($tab);
  37. for ($i=0;$i<5;$i++)
  38. {
  39. echo $tab[$i]." ";
  40. };
  41.  
  42. ?>
  43. </body>
  44.  
  45. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement