a)
Program TAM_GIAC;
uses crt;
var a,b,c,p,S: real;
Begin
clrscr;
Write('Nhap canh a:');readln(a);
Write('Nhap canh b:');readln(b);
Write('Nhap canh c:');readln(c);
p:=(a+b+c)/2;
S:=sqrt(p*(p-a)*(p-b)*(p-c));
Write('Dien tich tam giac la:',s:10:2);
readln
end.
b) Program Hinh_vuong;
uses crt;
var a,s,cv: Real;
Begin
clrscr;
Write('Nhap chieu dai canh:'); Readln(a);
s:=a*a;
cv:=a*4;
Writeln('Chu vi hinh vuong la:',cv);
Writeln('Dien tich hinh vuon la:',s);
Readln
End.
quá dễ
a) uses crt;
var ab,bc,ca,cv:integer;
p,dt:real;
begin
clrscr;
write('nhap canh AB='); readln(ab);
write('nhap canh BC='); readln(bc);
write('nhap canh CA='); readln(ca);
if (ab+bc>ca) and (ab+ca>bc) and (bc+ca>ab) then
begin
cv:=ab+bc+ca;
p:=cv/2;
dt:=sqrt(p*(p-ab)*(p-ac)*(p-bc));
writeln('chu vi hinh tam giac la: ',cv);
writeln('dien tich hinh tam giac la: ',dt:4:2);
end
else writeln('day khong la 3 canh trong 1 tam giac');
readln;
end.
b) uses crt;
var a,cv,dt:integer;
begin
clrscr;
write('nhap 1 canh bat ky cua hinh vuong:'); readln(a);
cv:=a*4;
dt:=sqr(a);
writeln('chu vi hinh vuong la: ',cv);
writeln('dien tich hinh vuong la: ',dt);
readln;
end.
a) Program Hinh_Tamgiac_Program;
Uses crt;
Var a,b,c,s,p : real;
Begin
Clrscr;
Writeln(‘HINH 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,’, ‘, b,’, ‘, c, ‘ khong phai la ba canh cua tam giac’) ;
Readln;
End.
b)
uses crt;
var
a,S,C: integer;
begin
clrscr;
write('Nhap do dai canh hinh vuong: ');readln(a);
C:=a*4;
S:=a*a;
writeln('Chu vi hinh vuong la: ',C);
writeln('Dien tich hinh vuong la: ',S);
readln
end.
a) uses crt;
var ab,bc,ca,cv:integer;
p,dt:real;
begin
clrscr;
write('nhap canh AB='); readln(ab);
write('nhap canh BC='); readln(bc);
write('nhap canh CA='); readln(ca);
if (ab+bc>ca) and (ab+ca>bc) and (bc+ca>ab) then
begin
cv:=ab+bc+ca;
p:=cv/2;
dt:=sqrt(p*(p-ab)*(p-ac)*(p-bc));
writeln('chu vi hinh tam giac la: ',cv);
writeln('dien tich hinh tam giac la: ',dt:4:2);
end
else writeln('day khong la 3 canh trong 1 tam giac');
readln;
end.
b) uses crt;
var a,cv,dt:integer;
begin
clrscr;
write('nhap 1 canh bat ky cua hinh vuong:'); readln(a);
cv:=a*4;
dt:=sqr(a);
writeln('chu vi hinh vuong la: ',cv);
writeln('dien tich hinh vuong la: ',dt);
readln;
end.