program FindRoots; var a, b, c: integer; D: integer; x1, x2: real; begin a := 3; b := 2; c := -4;
D := b b - 4 a * c;
if D > 0 then begin x1 := (-b + sqrt(D)) / (2 a); x2 := (-b - sqrt(D)) / (2 a); writeln('The roots are: x1 = ', x1:0:2, ' and x2 = ', x2:0:2); end else if D = 0 then begin x1 := -b / (2 * a); writeln('The root is: x = ', x1:0:2); end else writeln('The equation has no real roots.'); end.
program FindRoots;
var
a, b, c: integer;
D: integer;
x1, x2: real;
begin
a := 3;
b := 2;
c := -4;
D := b b - 4 a * c;
if D > 0 then
begin
x1 := (-b + sqrt(D)) / (2 a);
x2 := (-b - sqrt(D)) / (2 a);
writeln('The roots are: x1 = ', x1:0:2, ' and x2 = ', x2:0:2);
end
else if D = 0 then
begin
x1 := -b / (2 * a);
writeln('The root is: x = ', x1:0:2);
end
else
writeln('The equation has no real roots.');
end.