Program Tinh_Dien_Tich;
Uses crt;
Procedure HV;
Var s,a:real; Begin
Writeln(‘TINH DIEN TICH HINH VUONG:’);
Write(‘Nhap chieu dai cua canh a = ‘);readln(a); s:=a*a;
Writeln(‘Dien tich hinh vu />End;
Procedure HT;
Var s,r:real;
Begin
Writeln(‘TINH DIEN TICH HINH TRON:’);
Write(‘Nhap ban kinh R = ‘);
readln(r); s:=pi*r*r;
Writeln(‘Dien tich hinh tr />End;
Procedure TG;
Var a, b, c,s,p:real; Begin
Writeln(‘TINH DIEN TICH TAM GIAC:’);
Write(‘nhap a =’);readln(a);
Write (‘nhap b =’);readln(b); Write(‘nhap c =’);readln(c);
If ((a+b)>c)and((b+c)>a)and((a+c)>b) then
Begin
p:=(a+b+c)/2;
s:=sqrt(p*(p-a)*(p-b)*(p-c));
Writeln(‘Chu vi tam giac:’,2*p:4:2) ;
Writeln(‘Dien tich tam giac:’,s:4:2);
End
Else
Writeln(a,’, ‘,’, ‘,c,’ khong phai la ba canh cua tam giac’) ;
End;
Procedure CN;
Var a, b, s:real; Begin
Writeln(‘TINH DIEN TICH HINH CHU NHAT:’);
Write(‘Nhap chieu dai a =’);readln(a);
Write(‘Nhap chieu rong b= ‘);readln(b);
s:= a*b;
Writeln(‘Dien tich hinh chu nhat, s= ‘,s:6:2);
End;
Procedure menu;
Var d:integer;
Begin
Clrscr;
Writeln(‘CHON MOT TRONG CAC PHUONG AN SAU:’);
Writeln(‘0: Quay ve man hinh soan thao’);
Writeln(‘1: Tinh dien tich hinh vuong’);
Writeln(‘2: Tinh dien tich hinh tron’);
Writeln(‘3: tinh dien tich tam giac’);
Writeln(‘4: Tinh dien tich hinh chu nhat’);
Writeln(‘====================================’);
Write(‘ Hay chon mot phuong an: ‘); readln(d); Writeln(‘====================================’);
Writeln;
Case d of
0: Exit;
1: HV;
2: HT;
3: TG;
4: CN;
End;
End;
Begin
menu;
Readln;
End.