Sử dụng hàm kiểm tra 3 cạnh của tam giác ABC Dạ giúp em em cần gấp 15/07/2021 Bởi Samantha Sử dụng hàm kiểm tra 3 cạnh của tam giác ABC Dạ giúp em em cần gấp
uses crt; var a,b,c: integer; function kt(a,b,c:integer):boolean; begin if (a+b>c) and (b+c>a) and (a+c>b) then exit(true); exit(false); end; begin clrscr; write (‘nhap canh thu nhat cua tam giac: ‘); readln (a); write (‘nhap canh thu hai cua tam giac: ‘); readln (b); write (‘nhap canh thu ba cua tam giac: ‘); readln (c); if kt(a,b,c)=true then writeln(‘Day la 3 canh cua tam giac’) else writeln(‘Day khong phai la 3 canh cua tam giac’) readln; end. Bình luận
uses crt; var a,b,c: integer; begin clrscr; write (‘nhap canh thu nhat cua tam giac: ‘); readln (a); write (‘nhap canh thu hai cua tam giac: ‘); readln (b); write (‘nhap canh thu ba cua tam giac: ‘); readln (c); if ((a+b)>c) and ((a+c)>b) and ((c+b)>a) then begin if (sqr(a)+sqr(b)=sqr(c)) or (sqr(b)+sqr(c)=sqr(a)) or (sqr(a)+sqr(c)=sqr(b)) thenwrite (‘day la tam giac vuong’); if (a=b) or (b=c) or (a=c) then write (‘day la tam giac can’); if (a=b) and (b=c) then write (‘day la tam giac deu’); end else writeln (‘3 canh nay ko the tao thanh 1 tam giac’); readln; end. Bình luận
uses crt;
var a,b,c: integer;
function kt(a,b,c:integer):boolean;
begin
if (a+b>c) and (b+c>a) and (a+c>b) then exit(true);
exit(false);
end;
begin
clrscr;
write (‘nhap canh thu nhat cua tam giac: ‘); readln (a);
write (‘nhap canh thu hai cua tam giac: ‘); readln (b);
write (‘nhap canh thu ba cua tam giac: ‘); readln (c);
if kt(a,b,c)=true then writeln(‘Day la 3 canh cua tam giac’)
else writeln(‘Day khong phai la 3 canh cua tam giac’)
readln;
end.
uses crt;
var a,b,c: integer;
begin
clrscr;
write (‘nhap canh thu nhat cua tam giac: ‘); readln (a);
write (‘nhap canh thu hai cua tam giac: ‘); readln (b);
write (‘nhap canh thu ba cua tam giac: ‘); readln (c);
if ((a+b)>c) and ((a+c)>b) and ((c+b)>a) then
begin
if (sqr(a)+sqr(b)=sqr(c)) or (sqr(b)+sqr(c)=sqr(a)) or (sqr(a)+sqr(c)=sqr(b)) then
write (‘day la tam giac vuong’);
if (a=b) or (b=c) or (a=c) then write (‘day la tam giac can’);
if (a=b) and (b=c) then write (‘day la tam giac deu’);
end
else writeln (‘3 canh nay ko the tao thanh 1 tam giac’);
readln;
end.