1 câu trả lời
Program GIAI_PHUONG_TRINH_BAC_HAI;
Uses crt;
Var a,b,c,d,x,x1,x2:real; fv,fr:text;
Begin
assign(fv,'input.inp'); reset(fv);
assign(fr,'input.out'); rewrite(fr);
read(fv,a,b,c);
If a=0 then
If b=0 then
If c=0 then
Writeln(fr,'Phuong trinh co vo so nghiem')
Else
Writeln(fr,'Phuong trinh vo nghiem')
Else
Writeln(fr,'Phuong trinh co mot nghiem: x=',-c/b:4:2)
Else
Begin
d:=b*b-4*a*c;
If d=0 then
Writeln(fr,'Phuong trinh co nghiem kep: x=',-b/(2*a):4:2)
Else
If d<0 then
Writeln(fr,'Phuong trinh vo nghiem')
Else
Begin
x1:= (-b+sqrt(d))/(2*a);
x2:= (-b-sqrt(d))/(2*a);
Write('Phuong trinh co hai nghiem: ‘);
Writeln(fr,‘ x1=',x1:4:2,' va x2=',x2:4:2);
End;
End;
close(fv); close(fr);
Readln;
End.