var a,b,c,p,s:real;
begin
write('Nhap so thu nhat ');readln(a);
write('Nhap so thu hai ');readln(b);
write('Nhap so thu ba ');readln(c);
if (a + b > c) and (a + c > b) and (b + c > a) then
begin
writeln('Ba so vua nhap la ba canh cua tam giac');
p:=a+b+c;
s:=sqrt(p/2*(p/2-a)*(p/2-b)*(p/2-c));
writeln('Chu vi tam giac la ',p:10:2);
write('Dien tich tam giac la ',s:10:2);
end
else write('Ba so vua nhap khong phai ba canh cua tam giac');
readln;
end.
Program TAMGIAC;
Uses crt;
Var a,b,c,s,p: real;
Begin
Clrscr;
Writeln('BAI TOAN TAM GIAC:'); Writeln(' ');
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 .