jda_m06/uf01/exercicis_uf01_01/proves.html
2022-02-16 16:13:08 +01:00

31 lines
566 B
HTML
Executable file

<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Functions</h2>
<p>This example calls a function which performs a calculation, and returns the result:</p>
<p id="demo"></p>
<script>
num1 = parseInt(prompt("Primer nombre: "));
num2 = parseInt(prompt("Segon nombre: "));
num3 = parseInt(prompt("Tercer nombre: "));
total = ($num1*3600) + ($num2*60) + $num3 + 1;
hora = $total%3600;
minut = ($total-($hora*3600))%60;
segon = ($total-($hora*3600)-($minut*60));
alert($hora + ":" + $minut + ":" + $segon)
</script>
</body>
</html>