Advertisement
Gleidson_21

Básico de função

Jun 24th, 2021
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.40 KB | None | 0 0
  1. <?php
  2. //Criando e chamando funções
  3.  
  4.  
  5. function exibirNome($nome)
  6. {
  7.   echo "Meu nome é $nome";
  8. }
  9. exibirNome("Gleidson Camargos");
  10.  
  11. echo "<br> <hr>";
  12.  
  13.  
  14. function calcularMedia($nome, $n1, $n2, $n3, $n4)
  15. {
  16.  
  17.   $media = ($n1 + $n2 + $n3 + $n4) / 4;
  18.  
  19.   if ($media >= 7) :
  20.     echo "$nome aprovado";
  21.   else :
  22.     echo "$nome reprovado";
  23.  
  24.   endif;
  25. }
  26.  
  27. calcularMedia("Jean", 5, 10, 8, 4);
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement