program Quadratic_equation;
var
a, b, c, D, x1, x2 : real;
begin
writeln('ax^2 + bx + c = 0, a <> 0');
writeln('Укажите коэффициенты a, b и c');
write('a = '); readln(a);
write('b = '); readln(b);
write('c = '); readln(c);
D := sqr(b) - 4 * a * c;
if D < 0 then
begin
writeln('Корней в данном уравнении нет')
end
else
begin
if D = 0 then
begin
writeln('x = ', - b / (2 * a))
end
else
begin
x1 := (- b + sqrt(D)) / (2 * a);
x2 := (- b - sqrt(D)) / (2 * a);
writeln('x1 = ', x1);
writeln('x2 = ', x2);
end;
end;
end.
|