From d4f16262ac0f3d899312e4726126d114023b3bbb Mon Sep 17 00:00:00 2001 From: "durso.bruno" <42178793@terciariourquiza.edu.ar> Date: Fri, 29 May 2026 13:12:15 +0000 Subject: [PATCH] Subir archivos a "/" --- Clase 6 Ejercicio 6.js | 5 +++++ Clase 6 Ejercicio 7.js | 46 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 Clase 6 Ejercicio 6.js create mode 100644 Clase 6 Ejercicio 7.js diff --git a/Clase 6 Ejercicio 6.js b/Clase 6 Ejercicio 6.js new file mode 100644 index 0000000..3036151 --- /dev/null +++ b/Clase 6 Ejercicio 6.js @@ -0,0 +1,5 @@ +function saludar(nombre, edad) { + return `Me llamo ${nombre} y tengo ${edad} años.`; // se ponen ` y ${} para cada valor +} + +console.log(saludar("Bruno", 26)); // Recibe datos separados \ No newline at end of file diff --git a/Clase 6 Ejercicio 7.js b/Clase 6 Ejercicio 7.js new file mode 100644 index 0000000..8609519 --- /dev/null +++ b/Clase 6 Ejercicio 7.js @@ -0,0 +1,46 @@ +const numeros = [1, 3, 8, 2, 18, 6]; + +function maximo(numeros) { + + let mayor = numeros[0]; //los arrays empiezan en 0, 0 es 1, 1 es 3 + + for (let i = 1; i < numeros.length; i++) { //Empezamos dandole valor 1 a variable i, luego se empieza a recorrer todos los numeros y si son mayores a 1, despues se va sumando + + if (numeros[i] > mayor) { //primera vuelta, comparamos y pregunta 3>1?, y continua + mayor = numeros[i]; //busca el numero mas alto + } + + } + + return mayor; +} + +function minimo(array) { + + let menor = array[0]; + + for (let i = 1; i < array.length; i++) { + + if (array[i] < menor) { + menor = array[i]; + } + + } + + return menor; +} + +function promedio(array) { + + let suma = 0; + + for (let i = 0; i < array.length; i++) { + suma += array[i]; + } + + return suma / array.length; +} + +console.log("Máximo:", maximo(numeros)); +console.log("Mínimo:", minimo(numeros)); +console.log("Promedio:", promedio(numeros)); \ No newline at end of file