eje2.js 369 Bytes
Newer Older
Jose Figueredo committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

var x= Math.floor(Math.random() * 100);
var y= Math.floor(Math.random() * 100); 
var z= Math.floor(Math.random() * 100); 

console.log(x+ " "+y+" "+z);

raices(x,y,z);


function raices(a,b,c){

    var x1= (-1*b)+Math.sqrt(b**2 -4*a*c);
    var x2= (-1*b)-Math.sqrt(b**2 -4*a*c);

    x1= x1/(2*a);
    x2=x2/(2*a);

    console.log("Las raices son: "+x1+" "+x2); 

}