Tài liệu Giáo trình lý thuyết và bài tập Pascal_ Chương 1 - Pdf 88

GIAO TRINH LY THUYET VA BAI TAP TURBO PASCAL-CHUONG 1
Dang Thanh Tuan(15/3/2004)
**********0101**********
Program PTB2;
Var
a,b,c:Integer;
delta,x1,x2:Real;
Begin
Writeln('GIAI PHUONG TRINH BAC HAI');
Writeln(' --------------');
Repeat
Write('-Nhap he so a= ');
Readln(a);
Until a <>0;
Write('-Nhap he so b= ');
Readln(b);
Write('-Nhap he so c= ');
Readln(c);
delta:=b*b-4*a*c;
If delta < 0 Then
Writeln('*Phuong trinh vo nghiem')
Else
If delta = 0 Then
Writeln('*Phuong trinh co 2 nghiem bang nhau X= ',-b/2*a:6:2)
Else
Begin
x1:=(-b-sqrt(delta))/2*a;
x2:=(-b+sqrt(delta))/2*a;
Writeln('*Nghiem thu nhat X1= ',x1:6:2);
Writeln('*Nghiem thu hai X2= ',x2:6:2);
End;

Writeln('*Thuong cua hai so ',so1,' va ',so2,' = ',thuong:6:2);
Readln
End.
**********0104**********
Program Pithagore;
Var
a,b :Integer;
c:Real;
Begin
Writeln(' CHUONG TRINH TINH CANH HUYEN TAM GIAC VUONG');
Writeln(' theo dinh ly Pithagore');
Write('-Nhap canh a = ');
Readln(a);
Write('-Nhap canh b = ');
Readln(b);
c := Sqrt((a*a) + (b*b));
Writeln('*Canh huyen = ',c:6:2);
Readln
End.
**********0105**********
Program Phep_Cong;
Var
so1,so2,so3,tong :Integer;

Begin
Writeln(' CHUONG TRINH THUC HIEN PHEP CONG SO HOC');
Writeln(' co toi da 4 ky so');
Write('-Nhap so thu nhat = ');
Readln(so1);
Write('-Nhap so thu hai = ');

Writeln('Nam ');
Writeln('Quoc ');
Writeln('Son ');
Writeln('Ha ');
Writeln('Nam ');
Writeln('De ');
Writeln('Cu ');
Readln
End.
*********0108*********
Program Tam_giac_Pascal;
Begin
Writeln(' 1');
Writeln(' 1 1');
Writeln(' 1 2 1');
Writeln(' 1 3 3 1');
Writeln('1 4 6 4 1');
Readln
End.
*********0109*********
Program Hinh_tron;
Var
r:Integer;
s:Real;
Begin
Writeln('CHUONG TRINH TINH DIEN TICH HINH TRON');
Write('-Cho biet ban kinh = ');
Readln(r);
s:=3.1416 * r * r;
Writeln('*Dien tich hinh tron = ',s:6:2,' met vuong');


Nhờ tải bản gốc

Tài liệu, ebook tham khảo khác

Music ♫

Copyright: Tài liệu đại học © DMCA.com Protection Status