PROGRAM ptb2;
USES crt;
VAR a,b,c,x1,x2,d:REAL;
BEGIN
clrscr;
REPEAT
write('Nhap cac he so a, b, c: ');
readln(a,b,c);
UNTIL a<>0;
d:=sqr(b)-4*a*c;
IF d<0 THEN write('Phuong trinh vo nghiem!')
ELSE
BEGIN
x1:=(-b-sqrt(d))/(2*a);
x2:=(-b+sqrt(d))/(2*a);
IF d=0 THEN writeln('Phuong trinh co nghiem kep x = ',x1:5:1)
ELSE writeln('Phuong trinh co 2 nghiem phan biet: ',x1:5:1,x2:5:1);
END;
readln;
END.
Sign up here with your email
ConversionConversion EmoticonEmoticon