Два квадратных уравнения задано своими коэффициентами a1,b1,c1 та a2,b2,c2. Могут ли корни обеих уравнений быть сторонами некоего прямоугольника — Pascal(Паскаль)

var a1,b1,c1,a2,b2,c2,D1,D2,x1,x2,x3:real;
begin
writeln('Insert the coefficients of the first equation:');
readln(a1,b1,c1);
D1:=sqr(b1)-4*a1*c1;
Writeln('Insert the coefficients of the second equation:');
readln(a2,b2,c2);
D2:=sqr(b2)-4*a2*c2;
x1:=a1/a2;
x2:=b1/b2;
x3:=c1/c2;
if (D1=0) and (D2=0) and (((-b1)/(2*a1))>0) and (((-b2)/(2*a2))>0)
then writeln('roots are sides of a rectangle')
else  writeln('You"re not right');
if  (D1>0) and (D2>0) and(((-b1)-sqrt(D1))/(2*a1)>0)
and (((-b2)-sqrt(D2))/(2*a2)>0) and (((-b1)+sqrt(D1))/(2*a1)>0)
and (((-b2)+sqrt(D2))/(2*a2)>0) and (x1=x2)and(x2=x3)
then   writeln('roots are sides of a rectangle')
else writeln('Yo"ure not right');
end.

Leave a Comment

31 − 29 =