jda_m06/uf01/Exercicis UF1_1. Solucions-20211107/ex03_potencia.html
2022-02-16 16:13:08 +01:00

28 lines
506 B
HTML
Executable file

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Potencia</title>
</head>
<body>
<script>
var base=parseInt(prompt("Base:"));
var exponente=parseInt(prompt("Exponente: "));
var res = base;
for (var i = 1; i < exponente; i++) {
res *=base;
}
alert(res);
// Mas facil
// alert(base ** exponente);
</script>
</body>
</html>