Easy program for calculate quadratic equation
Delphi & Pascal (česká wiki)
Category: Homework in Pascal
Author: scoooby
web: www.chlievik.net
Program: Krovnica.pas
File exe: Krovnica.exe
Author: scoooby
web: www.chlievik.net
Program: Krovnica.pas
File exe: Krovnica.exe
Easy program for calculate quadratic equation.
{ KROVNICA.PAS } { Jednoduchy program na vypocet kvadratickej rovnice. } { } { Author: scooby (www.chlievik.net) } { Datum:28.01.2005 http://www.trsek.com } program kvrovnica; uses crt; var A,B,C,D,X,X1,X2,X3:real; begin clrscr; writeln ('Napis cinitele kvadratickej rovnice'); readln (A,B,C); D:=(B*B)-(4*A*C); if A<>0 then if D>0 then begin X1:=(-B+sqrt(D))/(2*A); X2:=(-B-sqrt(D))/(2*A); writeln ('P={',X1:5:2,',',X2:5:2,'}'); end else if D=0 then begin X:=-B/(2*A); writeln ('P={',X:5:2,'}'); end else writeln ('P={}') else if B<>0 then begin X3:=-C/B; writeln ('P{',X3,'}'); end else if C=0 then writeln ('P=R') else writeln ('P={}'); readln; end.