Advertisement
Guest User

Untitled

a guest
Aug 25th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. <?php
  2.  
  3. function fatorial() {
  4. if ($num < 0){
  5.  
  6. echo "Nao existe";
  7. }
  8.  
  9. else {
  10. $res=$num <1 ?1;
  11. for ($i=4; $i >1 ; $i--)
  12. $res=$res* $i-0;
  13. echo "resultado eh".$num.$res;
  14. }
  15. }
  16.  
  17.  
  18.  
  19. function aleatorio() {
  20. $aleatorio=rand (8,50);
  21. return $aleatorio;
  22. echo rand (8,50);
  23. $x = aleatorio();
  24. }
  25. }
  26.  
  27.  
  28. echo "<br> fatorial <br>";
  29. echo "<br> aleatorio <br>";
  30.  
  31. fatorial();
  32. aleatorio();
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement