2 câu trả lời
uses crt;
var denta,a,b,c,x1,x2:real;
begin
clrscr;
write('Nhap a, b, c= ');readln(a,b,c);
denta:=b*b-4*a*c;
if denta<0 then writeln('Pt vo nghiem') else
begin
x1:=(-b-sqrt(b*b-4*a*c)/(2*a);
x2:=-b/a-x1;
writeln('x1= ',x1:8:3,'x2= ',x2:8:3);
end;
readln;
end.
Program giai_phuong_trinh_bac_2;
Uses crt;
Var a,b,c,x1,x2,x,DT:Real;
BEGIN
CLRSCR;
Write('a= '); Readln(a);
Write('b= '); Readln(b);
Write('c= '); Readln(c);
DT:=b*b - 4*a*c;
If DT>0 then
Begin
Writeln('Phuong trinh co 2 nghiem phan biet la');
x1:= (-b+SQRT(DT))/(2*a);
x2:= (-b-SQRT(DT))/(2*a);
Writeln('x1= ', x1:8:2);
Writeln('x2= ', x2:8:2);
End
Else
If DT=0 Then
Begin
Writeln('Phương trinh co 1 nghiem kep la');
x:=(-b/(2*a));
Writeln('x= ', x:8:2);
End
Else
Writeln(' Phương trinh vo nghiem');
Readln;
END.
Câu hỏi trong lớp
Xem thêm