" Life is not a problem to be solved but a reality to be experienced! "
© Copyright 2013 - 2024 KUDO.TIPS - All rights reserved.
uses crt;
var
a,b,c,d : real;
x1,x2,x0 : real;
begin
clrscr;
writeln('Program rozwiazuje rownania kwadratowe');
write('Podaj wspolczynnik a: ');
readln(a);
repeat
if a= 0 then
begin
writeln ('Wspolczynnik ten nie moze rownac sie 0!. Prosze wpisz inny');
readln(a);
end;
until (a<>0);
write('Podaj wspolczynnik b: ');
readln(b);
write('Podaj wspolczynnik c: ');
readln(c);
d:= sqr(b) - 4*a*c;
if d>0 then
begin
x1:= (-b - sqrt(d))/(2*a);
x2:= (-b + sqrt(d))/(2*a);
writeln('Rownanie ma dwa rozwiazania');
writeln('x1 = ', x1:0:2);
writeln('x2 = ', x2:0:2);
end;
if (d=0) then
begin
x0:= -b/(2*a);
writeln('Rownanie ma jedno rozwiazenie');
writeln('x0 = ',x0:0:2);
end;
if d<0 then
writeln ('R˘wnanie nie ma rozwiazan');
readkey;
end.
Pozdrawiam i polecam się na przyszłość