% Script Quad2
% Solves ax^2 + bx + c = 0
% Assumes real roots.

a = input('Enter a: ');
b = input('Enter b: ');
c = input('Enter c: ');
d = sqrt(b^2 - 4*a*c);

r1 = (-b - d)/(2*a);
r2 = (-b + d)/(2*a);

% Formatted output...
disp(' ')
fprintf('Root1 = %10.6f\n',r1)
fprintf('Root2 = %10.6f\n',r2)


% Experiment with other formats, e.g., %8.2e.
% What if the "\n" is deleted?
% What if "\n" is replaced by "\n\n\n"?
