0 bình luận về “Viet chuong trinh pascal giai phuong trinh ax+b+c=0”
program kaito; uses crt; var a, b, x: real; begin clrscr; write(‘Giai phuong trinh bac nhat: ax +b =0’); write(‘Nhap he so a: ‘); readln(a); write(‘Nhap he so b: ‘); readln(b); x:=-b/a; if (a=0) then begin if (b=0) then writeln(‘Phuong trinh vo so ngiem’) else writeln(‘Phuong trinh vo nghiem’); end else writeln(‘Phuong trinh co nghiem duy nhat: ‘,x); readln end.
program kaito;
uses crt;
var a, b, x: real;
begin
clrscr;
write(‘Giai phuong trinh bac nhat: ax +b =0’);
write(‘Nhap he so a: ‘); readln(a);
write(‘Nhap he so b: ‘); readln(b);
x:=-b/a;
if (a=0) then
begin
if (b=0) then writeln(‘Phuong trinh vo so ngiem’)
else writeln(‘Phuong trinh vo nghiem’);
end
else writeln(‘Phuong trinh co nghiem duy nhat: ‘,x);
readln
end.
CHÚC BẠN HỌC TỐT!!!
Program GIAI_PHUONG_TRINH_BAC_NHAT;
Var a,b,x:real;
Begin
Clrscr;
Writeln(‘GIAI PHUONG TRINH BAC NHAT: AX + B=0’);
Writeln(‘————————————————————‘);
Write (‘Nhap a= ‘);
readln(a);
Write (‘Nhap b= ‘);
readln(b);
If(a=0) then If(b=0) then Writeln(‘ Phuong trinh co vo so nghiem’)
Else writeln(‘ Phuong tring vo nghiem’)
Else Writeln(‘Phuong trinh co nghiem x=’,-b/a:4:2);
Readln;
End.