ecuacioncuadratica.js 853 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
//Ejercicio nro 1
function ecuacion(a, b, c) {
    return (-b + Math.sqrt(Math.pow(b, 2) - 4 * a * c)) / (2 * a);

}
console.log(ecuacion(4, -64, 2));


//Ejercicio nro 2
function ecuacion(a, b, c) {
    return (-b - (Math.sqrt(Math.pow(b, 2) - 4 * a * c))) / (2 * a);

}
ecuacion(4, -64, 2);


//Ejercicio nro 3
function cosararahtml(id, string) {

    document.getElementById(id).innerHTML = string;

}
cosararahtml("elelegido", "hola soy un texto muy util la verdad");


//Ejercicio nro 4
function numeroaleatorio(id) {
    let value = Math.floor(Math.random() * (100 - 0) + 0);
    document.getElementById(id).innerHTML = value;

}
numeroaleatorio("acapone");

//Ejercicio nro 5
function numeroaleatorio(id) {
    let value = Math.floor(Math.random() * (100 - 0) + 0);
    document.getElementById(id).innerHTML = value;

}
numeroaleatorio("imagen");