Được gửi bởi
huyphuc1981_nb
Đề nghị muội post ảnh lên nhé. Nếu coi được cho
uses crt;
var a,b,c,x1,x2,d:extended;
begin
repeat
write(' press esc to quit.'); repeat until keypressed; if readkey=char(27) then exit;
clrscr;
write(' a=? :'); readln(a);
write(' b=? :'); readln(b);
write(' c=? :'); readln(c);
d:=b*b-4*a*c;
if d < 0 then begin writeln( 'vo nghiem. '); continue ; end;
if d = 0 then begin writeln( '1 nghiem: ',((-b) /(2*a)):0:5 ); continue ; end;
if d > 0 then begin
writeln( '2 nghiem. X1= ',(((-b)+sqrt(d)) /(2*a)):0:5, ' X2= ',(((-b)-sqrt(d)) /(2*a)):0:5 );
continue ; end;
until false;
end.
Bookmarks