Skip to content

Instantly share code, notes, and snippets.

@Marlysson
Last active December 20, 2015 05:19
Show Gist options
  • Save Marlysson/6077184 to your computer and use it in GitHub Desktop.
Save Marlysson/6077184 to your computer and use it in GitHub Desktop.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Media_Aluno</title>
</head>
<body>
<?php
$resultado = 0;
$notas = array(
'nota1' => $_POST['nota1'],
'nota2' => $_POST['nota2'],
'nota3' => $_POST['nota3'],
'nota4' => $_POST['nota4']
);
foreach($notas as $key => $values){
$resultado = $resultado + $values;
}
$media = ($resultado/count($notas));
if($media >= 7){
echo $media." - Aprovado";
}else{
echo $media." - Reprovado";
}
?>
<form action="" method="post">
Nota1<input type="text" name="nota1"><br>
Nota2<input type="text" name="nota2"><br>
Nota3<input type="text" name="nota3"><br>
Nota4<input type="text" name="nota4"><br><br>
<input type="submit" name="enviar" value="Calcular">
</form>
</body>
</html>
@Marlysson
Copy link
Author

Programa para calcular média de 4 notas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment