-2
<?php
$prova1 = 20;
$prova2 = 12;
$prova3 = 5;
$media = ($prova1 + $prova2 + $prova3)/3;
echo "A média deu: $media";
if ($media >= 9,5)
{
echo "// Parabéns você foi aprovado";
}
elseif ($media > 8 && $media < 9,5)
{
echo "// Terá de ir a recuperação";
}
else ($media <= 8)
{
echo "// Você foi reprovado";
}
?>
In PHP the decimal separator is the point, so the number "nine and a half" is
9.5
, nay9,5
. When executing the code appears the error stating this: "syntax error, Unexpected ',' ... on line 8"– Woss
Incidentally,
else
has no condition... he is theelse
...– Woss
And if the grades can be higher than 10, there’s no guarantee that the average will be 0 to 10.
– Woss
Thanks for the help . By chance my friend told me about Isis but we do not remember that it was necessary point instead of comma
– Ruben