program proc4; 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; quit :char; procedure input; begin 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; end; procedure calc_output; begin 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; end; begin repeat clrscr; input; calc_output; writeln; writeln; write ('Do you want to quit? (type Y or N) ---> '); quit := upcase(readkey); until quit = 'Y'; end.