{ **************************************************************** }
{ First attempt at a program to calculate the roots of a quadratic }
{ equations, AX^2 + BX + C = 0. Note that in this program each     }
{ variable is assigned to only once.                               }
{ This is much better style than the first program                 }
{ **************************************************************** }

program quad_roots(input, output);
{ The variables here are real numbers }
var 
  A,B,C, Discriminant, Root1, Root2 : real;

begin
  { Get the values of A, B and C from the user }
  writeln;
  write( 'A = ' ); readln(A);
  write( 'B = ' ); readln(B);
  write( 'C = ' ); readln(C);

  { Calculate the discriminant }
  Discriminant := B*B - 4*A*C;

  { Calculate the two roots }
  Root1 := (-B + sqrt( Discriminant )) / (2*A);
  Root2 := (-B - sqrt( Discriminant )) / (2*A);

  { Print the results }
  writeln;
  writeln( 'Root 1 = ', Root1:5:3 );
  writeln( 'Root 2 = ', Root2:5:3 );
end.
