diff --git a/#README.md# b/#README.md# new file mode 100644 index 0000000..4123538 --- /dev/null +++ b/#README.md# @@ -0,0 +1 @@ +Para usarlo solo hay que ejecutar el .html de la carpeta, todas las funciones estan dentro y se ejecutaran automaticamente, y pedira datos al usuario los respectivos ejercicios que piden ingresar datos. \ No newline at end of file diff --git a/Cuestionario JS 3.docx b/Cuestionario JS 3.docx deleted file mode 100644 index d141d27..0000000 Binary files a/Cuestionario JS 3.docx and /dev/null differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/README.md diff --git a/js3/ejercicios.js b/js3/ejercicios.js new file mode 100644 index 0000000..85c5807 --- /dev/null +++ b/js3/ejercicios.js @@ -0,0 +1,176 @@ +function numerosprimos() { + var numero = 100; + for (i = 2; i < numero; i++) { + for(j=2;j<=(i**0.5);j++) { + if (i%j == 0) { + console.log(j); + } + } + } +} + +function factorial() { + var resultado=1; + for (i = 1; i <= 50; i++) { + resultado=i*resultado; + console.log("Factorial de "+i+" es :"+resultado); + } +} + +function divisible() { + var numero = prompt("Introduzca numero"); + if (numero%5 == 0 && numero%11 == 0) { + alert("Es divisible por 5 y 11 "); + }else{ + alert("No es divisible entre 5 y 11 "); + } +} + +function edad() { + var edad = prompt("Ingrese su edad"); + if (edad >= 18) { + alert("Es mayor de edad, PUEDE IRSE PRESO!!!") + }else{ + alert("Es menor de edad, vivis con tus papas seguro."); + } +} + +function suma() { + var numero1 = parseInt(prompt("Ingrese primer numero")); + var numero2 = parseInt(prompt("Ingrese segundo numero")); + + alert("La suma es "+(numero1+numero2)); +} + +function celcius() { + var centigrados = parseFloat(prompt("Ingrese los grados Celsius")); + alert("La temperatura en Fahrenheit es: "+((centigrados*(9/5)+32))); +} +function division() { + var num = parseFloat(prompt("Ingrese numero a dividir por 10")); + alert("Resultado: "+(num/10)); +} +function dias(){ + var dia = prompt("Ingrese nombre del dia"); + switch (dia) { + case "Lunes": case "lunes": + dia = 1; + break; + case "Martes": case "martes": + dia = 2; + break; + case "Miercoles": case "miercoles": + dia = 3; + break; + case "Jueves": case "jueves": + dia = 4; + break; + case "Viernes": case"viernes": + dia = 5; + break; + case "Sabado": case "sabado": + dia = 6; + break; + case "Domingo": case "domingo": + dia = 7; + break; + default: + dia = "Dia no valido"; + break; + } + alert(dia); +} +function pares() { + var par1 = parseInt(prompt("Ingrese primer numero")); + var par2 = parseInt(prompt("Ingrese segundo numero")); + var acu = 0; + for (i = par1; i <= par2; i++) { + if (i%2==0) { + acu = acu + i; + } + + } + console.log("La suma de los pares entre "+par1+" y "+par2+" es "+acu); +} + +/* + function palindrome() { + var palabra = prompt("Ingrese su palabra"); + palabra = palabra.toLowerCase(); + alrevez = palabra.split("").reverse().toString(); + for (let index = 0; index < alrevez; index++) { + alrevez = alrevez.replace(",",""); + } + if (palabra == alrevez) { + alert("La palabra no es Palidromo"); + }else{ + alert("La palabra es Palidromo"); + } +}*/ + +function ordenado(vector) { + aux = vector.slice(0); + aux.sort(); + for (i = 0; i < vector.length; i++) { + if (aux[i] == vector[i]) { + console.log("Es ordenado"); + }else{ + console.log("No es ordenado"); + } + } +} + +function sumarArray() { + x = [2, 3, 7]; + y = x.slice(0); + for (i = 0; i < x.length; i++) { + y[i] = x[i]+1; + } + console.log(y); +} + +function ordenarArray(vector) { + x = vector.slice(0); + x.sort(function(a, b){return a-b}); + console.log(x); +} + +function intercambiar() { + var pares = [2, 4, 6, 8]; + var a = pares.indexOf[0]; + var b = pares.indexOf[1]; + pares[0] = b; + pares[1] = a; + console.log(pares); +} + +function promedio() { + var valores = [5, 8, 12, 16]; + var suma; + var division; + suma = valores[0]+valores[1]+valores[2]+valores[3]; + division = suma/valores.length; + console.log("Los valores del Vector: "+valores); + console.log("El promedio es: "+division); +} +function semana(valor) { + var dias = ["lunes","martes","miercoles","jueves","viernes","sabado","domingo"]; + console.log(dias[valor-1]); +} + +numerosprimos(); +factorial(); +divisible(); +edad(); +suma(); +celcius(); +division(); +dias(); +pares(); +//palindrome(); +ordenado([1, 5, 0, 8]); +sumarArray(); +ordenarArray([5, 2, 18, 11]); +intercambiar(); +promedio(); +semana(prompt("Ingrese dia de la semana")); \ No newline at end of file diff --git a/js3/js-003.html b/js3/js-003.html new file mode 100644 index 0000000..78549be --- /dev/null +++ b/js3/js-003.html @@ -0,0 +1,11 @@ + + + + + JS-003 + + +

EJERCICIOS EN LA CONSOLA

+ + + \ No newline at end of file