Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. <?php
  2.  
  3. sinda jes glupi
  4.  
  5. function pole ($a, $b, $c)
  6. {
  7. if($a+$b > $c && $b+$c > $a && $c+$a > $b)
  8. {
  9. if($a>0 && $b > 0 && $c > 0)
  10. {
  11. $p = ($a+$b+$c) / 2;
  12. $s = sqrt($p*($p-$a)*($p-$b)*($p-$c));
  13. return $s;
  14. }
  15. else
  16. {
  17. echo "nie trojkat";
  18. $s = 0;
  19. }
  20. }
  21. else
  22. {
  23. echo "nie ma takiego trojkata";
  24. }
  25. }
  26. for($i = 0; $i <10; $i++)
  27. {
  28.  
  29. $d = rand(0, 100);
  30. $e = rand(0, 100);
  31. $f = rand(0, 100);
  32.  
  33. $o = pole ($d, $e, $f);
  34. echo $o . "</br>";
  35. }
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement