You are on page 1of 3

program Project1;

uses
dialogs,sysutils;
var
x,y,z,w:string;
a,b,c,d:integer;
x1,x2,x3:integer;
hallado:boolean;
s,k:string;
begin
x:=inputbox('Ingrese Numero','valorA','');
y:= inputbox('Ingrese Numero','valorB','');
z:= inputbox('Ingrese Numero','valorC','');
w:= inputbox('Ingrese Numero','valorD','');
a:=strtoint(x);
b:= strtoint(y);
c:= strtoint(z);
d:= strtoint(w);
hallado:=false;
s:='Las raices de nuesto polinomio
son:'+#13+#13+'x1'+#9+'x2'+#9+'x3'+#13;
k:=inttostr(a)+'*^3+'+inttostr(b)+'*x^2+'+inttostr(c)
+'*x+'+inttostr(d)+'=0'+#13+#13;
for x1:=100to 100do
for x2:=100 to 100 do
for x3:=100 to 100 do
if a*x1*x1*x1+b*x1*x1+c*x1+d=0 then
if a*x2*x2*x2+b*x2*x2+c*x2+d=0 then
if a*x3*x3*x3+b*x3*x3+c*x3+d=0 then
if (x1<>x2)and(x1<>x3)and(x2<>x3) then
begin
s:=k+s+inttostr(x1)+#9+inttostr(x2)+#9+inttostr(x3);
showmessage(s);
hallado:=true;
if hallado then
exit
end;
begin
hallado:=false;

for x1:=-100 to 100 do


for x2:=-100 to 100 do
for x3:=-100 to 100 do
if a*x1*x1*x1+b*x1*x1+c*x1+d=0 then
if a*x2*x2*x2+b*x2*x2+c*x2+d=0 then
if a*x3*x3*x3+b*x3*x3+c*x3+d=0 then
if x1+x2+x3=-b then
if x1*x2+x1*x3+x2*x3=c then
if x1*x2*x3=-d then
if (x1=x2)and(x2=x3)and(x1=x3) then
else
if (x1=x2)or(x3<>x1)and(x3<>x2) then
begin
s:=k+s+inttostr(x1)+#9+inttostr(x2)+#9+inttostr(x3);
showmessage(s);
hallado:=true;
if hallado then
exit
end;
begin
hallado:=false;
for x1:=-100 to 100 do
for x2:=-100 to 100 do
for x3:=-100 to 100 do
if a*x1*x1*x1+b*x1*x1+c*x1+d=0 then
if a*x2*x2*x2+b*x2*x2+c*x2+d=0 then
if a*x3*x3*x3+b*x3*x3+c*x3+d=0 then
if (x1=x2)and(x2=x3)and(x1=x3) then
begin
s:=k+s+inttostr(x1)+#9+inttostr(x2)+#9+inttostr(x3);
showmessage(s);
hallado:=true;
if hallado then
exit
end;
begin
hallado:=false;
showmessage('LA ECUACION NO TIENE SOLUCION;DESBORDE POR
EXCESO');
end;
end;
end;
end.

You might also like