Blame | Last modification | View Log | Download
program druhy;
{$N+}
uses crt;
var
a,b,c : integer;
koren1,koren2 : double;
type
koreny = record
x1 : double;
x2 : double;
end;
procedure vyres(a,b,c: integer; var x1,x2 : double);
var
diskr : double;
begin
diskr:= b*b -4 * a * c;
if (diskr < 0) then
begin
writeln ('Rovnice nema realne reseni');
exit;
end;
if(diskr = 0) then
begin
x1:= -b/2*a;
writeln('rovnice ma jeden koren : ', x1)
end
else begin
x1:= (-b+sqrt(diskr))/2;
x2:= (-b-sqrt(diskr))/2;
writeln('Rovnice ma dva koreny ',x1,' ',x2)
end;
end;
begin
clrscr;
writeln ('zadejte tri koreny rovnice:');
readln(a);
readln(b);
readln(c);
vyres(a,b,c, koren1, koren2);
readln;
end.