<?php

$nota_ponderada = 0.0;
$pesos_somados = 0;

for($i = 0; $i < 3;$i++) {
    $nota = (float) trim(fgets(STDIN));
    $peso = (int) trim(fgets(STDIN));
    $nota_ponderada += ($nota*$peso);
    $pesos_somados += $peso;
}
$media_ponderada = $nota_ponderada / $pesos_somados;
printf("%.1f", $media_ponderada);

?>

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: