- BigDargon♥ Root ♥
Tổng số bài gửi : 1023
Age : 31
Bạn đến từ : BigDargon's Site
Nghề nghiệp : Học sinh
Tự bạch : http://tinyurl.com/profilebig
Registration date : 18/12/2007
Giải phương trình bậc hai
Thu Nov 20, 2008 3:48 pm
Đề bài :
Nhập vào hệ số a, b, c của phương trình bậc 2. Hãy đưa ra kết quả của bài toán.
Giải
Download File .EXE
Download File .PAS
Download File .ZIP
Nhập vào hệ số a, b, c của phương trình bậc 2. Hãy đưa ra kết quả của bài toán.
Giải
Download File .EXE
Download File .PAS
Download File .ZIP
- BigDargon♥ Root ♥
Tổng số bài gửi : 1023
Age : 31
Bạn đến từ : BigDargon's Site
Nghề nghiệp : Học sinh
Tự bạch : http://tinyurl.com/profilebig
Registration date : 18/12/2007
Re: Giải phương trình bậc hai
Wed Nov 26, 2008 3:08 pm
- Code:
Program Giai_PT_Bac_2_Power_By_BigDargon;
Uses crt;
Var
a,b,c,D,X1,X2,X:real;
BEGIN
clrscr;
Write('Nhap cac he so phuong trinh theo thu tu nhe !');Writeln;Writeln;
GotoXY(5,WhereY);Write('He so a = ');Readln(a);Writeln;
GotoXY(5,WhereY);Write('He so b = ');Readln(b);Writeln;
GotoXY(5,WhereY);Write('He so c = ');Readln(c);Writeln;
Write('Nhan phim Enter de chuong trinh hoat dong');Readln;Writeln;
D:=b*b-4*a*c;
IF
D<0
THEN
BEGIN
Writeln('***********************************************************');
Writeln('* *');
Writeln('* Phuong trinh ban vua nhap vo nghiem *');
Writeln('* *');
Writeln('***********************************************************');Writeln;
Writeln('Power By BigDargon - HomePages : http://bigdargon.blogspot.com');
Writeln;Write(' Nhan Enter de thoat !');
END
ELSE
IF
D=0
THEN
BEGIN
Writeln('******************************************************************');
Writeln('* *');
Writeln('* Phuong trinh ban vua nhap co nghiem kep X1 = X2 = X = ',X:8:5,' *');
Writeln('* *');
Writeln('******************************************************************');Writeln;
Writeln(' Power By BigDargon - HomePages : http://bigdargon.blogspot.com');
Writeln;Write(' Nhan Enter de thoat !');
END
ELSE
BEGIN
X1:=(-b-sqrt(D))/(2*a);
X2:=(-b+sqrt(D))/(2*a);
Writeln('********************************************************************');
Writeln('* *');
Writeln('* Nghiem thu nhat cua phuong trinh ban vua nhap la X1 = ',X1:8:5,' *');
Writeln('* *');
Writeln('* Nghiem thu hai cua phuong trinh ban vua nhap la X2 = ',X2:8:5,' *');
Writeln('* *');
Writeln('********************************************************************');Writeln;
Writeln(' Power By BigDargon - HomePages : http://bigdargon.blogspot.com');
Writeln;Write(' Nhan Enter de thoat !');
END;
Readln;
END.
Permissions in this forum:
Bạn không có quyền trả lời bài viết
|
|