Program HPT_BAC_NHAT_2_AN;
uses crt;
var a,b,c: real;
d,e,f: real;
x,y: real;
traloi: c-har;
begin
repeat
clrscr;
writeln('Giai he phuong trinh bac nhat 2 an');
writeln('------------------------------------------------');
write('nhap he so a= ');readln(a);
write('nhap he so b= ');readln(b);
write('nhap he so c= ');readln(c);
write('nhap he so a1= ');readln(d);
write('nhap he so b1= ');readln(e);
write('nhap he so c1= ');readln(f);
readln;
if ((a*e)-(d*b))<>0 then
begin
x:= ((c*e)-(f*b))/((a*e)-(d*b));
y:= ((a*f)-(d*c))/((a*e)-(d*b));
writeln('vay phuong trinh co mot nghiem x=',x,' va y=',y);
end;
if ((a*e)-(d*b))=0 then
begin
if (((c*e)-(f*b))<>0) or (((a*f)-(d*c))<>0) then
writeln('he phuong trinh vo nghiem HI!HI!...HI!');
if (((c*e)-(f*b))= 0) and (((a*f)-(d*c))=0) then
writeln('he co vo so nghiem x thuoc R va y=(c-ax)/b nghiem cua he la nghiem cua ax+by=c');
end;
writeln('ban co muon tiep tuc thuc hien nua khong (Y/N)?');readln(traloi);
until (traloi='N') or(traloi='n');
writeln('nhan ENTER de ket thuc chuong trinh');
readln
end.