Transfer to git
This commit is contained in:
15
archive/ver_1-until2feb2026/js/calc1.js
Normal file
15
archive/ver_1-until2feb2026/js/calc1.js
Normal file
@@ -0,0 +1,15 @@
|
||||
function calc() {
|
||||
let resultado = 0;
|
||||
const numeros = [];
|
||||
const quantity = parseInt(prompt("Ingrese la cantidad de números a sumar."));
|
||||
|
||||
for (let i = 0; i < quantity; i++) {
|
||||
numeros[i] = parseInt(prompt("Ingrese el "+(i+1)+"° número."));
|
||||
while (isNaN(numeros[i]) == true) {
|
||||
numeros[i] = parseInt(prompt("Repita el "+(i+1)+"° número."));
|
||||
}
|
||||
resultado += numeros[i];
|
||||
}
|
||||
|
||||
alert("El resultado de la suma es "+resultado);
|
||||
}
|
||||
Reference in New Issue
Block a user