Quadratische Gleichungen lösen

Gelöst werden soll eine quadratische Gleichung vom Typ
$$ x^2 + p x +q = 0 \quad . $$

Berechne die beiden gesuchten Nullstellen.

var num1="global";
var num2= "global";

function ausgabe()
{
if ( ( (document.form.x1.value==num1) && (document.form.x2.value==num2) )
|| ( (document.form.x1.value==num2) && (document.form.x2.value==num1) ) )
{
alert("Richtig!");
location.reload();
}
else alert("Versuch es nochmal. ");
}

function loes()
{
alert("Ergebnis: x1 = "+ num1 + " und x2 = " + num2);
location.reload();
}

{
num1 = Math.round(Math.random()*20)-10;
num2 = Math.round(Math.random()*20)-10;
var z1= -(num1+num2) ;
var z2 = num1*num2;

erg=0;
document.write("$ x^2+");

document.write(z1,"x + ", z2);
document.write(" = 0$ ", " ");
}

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer