program roots; uses crt; {-------------------------------------------------------------------------- This program will compute the roots of the quadratic equation ax2 + bx + c = 0. A, B, and C are read. by --------------------------------------------------------------------------} VAR a,b,c,y,x,x2:real; z:integer; begin clrscr; write ('Please enter a value for A ---> '); readln (a); write ('And now a valure for B ---> '); readln (b); write ('Finally, a value for C ---> '); readln (c); writeln; writeln; writeln; y := sqr(b) - 4 * a * c ; if y < 0 then writeln ('NO REAL ROOTS') else begin x := (0 - b + sqrt(y)) / (2 * a); x2 := (0 - b - sqrt(y)) / (2 * a) ; if x = x2 then writeln ('EQUAL ROOTS = ',x2:0:3) else writeln ('ROOT1 = ',x:0:3,', ROOT2 = ',x2:0:3); end; readln; end.