Var a,b,c,D,x1,x2,p,q:Real; Begin Repeat Write('a= '); Readln(a); if a=0 then writeln('Error: a=0. Enter another value'); Until a<>0; Write('b= '); Readln(b); Write('c= '); Readln(c); p:=b/a; q:=c/a; D:=Sqr(p/2)-q; If D>0 then begin Writeln('x1 = ',-p/2-Sqrt(D):0:5); Writeln('x2 = ',-p/2+Sqrt(D):0:5); end else If D=0 then Writeln('x1 = x2 = ',-p/2:0:5) else begin Writeln('x1 = ',-p/2:0:5,'-i*',Sqrt(-D):0:5); Writeln('x2 = ',-p/2:0:5,'+i*',Sqrt(-D):0:5); end; Readln; End.
Program yravnenie;
Var
a,b,c,D,x1,x2,p,q:Real;
Begin
Repeat
Write('a= ');
Readln(a);
if a=0 then writeln('Error: a=0. Enter another value');
Until a<>0;
Write('b= ');
Readln(b);
Write('c= ');
Readln(c);
p:=b/a;
q:=c/a;
D:=Sqr(p/2)-q;
If D>0 then
begin
Writeln('x1 = ',-p/2-Sqrt(D):0:5);
Writeln('x2 = ',-p/2+Sqrt(D):0:5);
end
else
If D=0 then
Writeln('x1 = x2 = ',-p/2:0:5)
else
begin
Writeln('x1 = ',-p/2:0:5,'-i*',Sqrt(-D):0:5);
Writeln('x2 = ',-p/2:0:5,'+i*',Sqrt(-D):0:5);
end;
Readln;
End.