var D, x1, x2;
var a = document.getElementById('a').value; // get the value of a
var b = document.getElementById('b').value; // get the value of b
var c = document.getElementById('c').value; // get the value of c
var result = document.getElementById('r').value; // we obtain a paragraph with id r
var result2 = document.getElementById('r2').value; // we obtain a paragraph with id r2
var result3 = document.getElementById('r3').value; // we obtain a paragraph with id r3
D = (b * b - 4 * (a * c)); // we find the discrepancy
r.innerHTML = ('D=' + b + '<sup>2</sup>' + '- 4*(' + a + ' * ' + c + ')=' + D); // output the answer
x1 = ((-b + Math.sqrt(D)) / (2 * a));
r2.innerHTML = (x1);
x2 = ((-b - Math.sqrt(D)) / (2 * a));
r3.innerHTML = (x2);