Skip to content

Instantly share code, notes, and snippets.

@residentkrm
Created July 17, 2013 16:18
Show Gist options
  • Save residentkrm/6022087 to your computer and use it in GitHub Desktop.
Save residentkrm/6022087 to your computer and use it in GitHub Desktop.
uses crt;
var a,b,c:integer;
cosa,cosb,cosc:real;
rb, rs, rz, ao, ap, at:boolean;
begin
ClrScr;
write('введите строну a = ');
readln(a);
write('введите строну b = ');
readln(b);
write('введите строну c = ');
readln(c);
if (c-b-a>=0) or (b-c-a>=0) or (a-b-c>=0)
then
begin
writeln('ТАКОЙ ТРЕУГОЛЬНИК НЕ СУЩЕСТВУЕТ');
readkey;
exit
end;
cosa:=(sqr(b)+sqr(c)-sqr(a))/(2*b*c);
cosb:=(sqr(a)+sqr(c)-sqr(b))/(2*a*c);
cosc:=(sqr(a)+sqr(b)-sqr(c))/(2*a*b);
writeln;
if (a-b=0) and (c-0=a) then rs:=true;
if ((a-b=0) and (c-0-a<>0)) or ((a-c=0) and (b-0-a<>0)) or ((c-b=0) and (a-0-c<>0)) then rb:=true;
if (a<>b) and (a<>c) and (b<>c) then rz:=true;
if (cosa>0) and (cosb>0) and (cosc>0) then ao:=true;
if (cosa=0) or (cosb=0) or (cosc=0) then ap:=true;
if (cosa<0) or (cosb<0) or (cosc<0) then at:=true;
if (rs) then writeln('Треугольник равносторонний');
if (rb) then writeln('Треугольник равнобедренный');
if (rz) then writeln('Треугольник разносторонний');
if (ao) then writeln('Треугольник остроугольный');
if (ap) then writeln('Треугольник прямоугольный');
if (at) then writeln('Треугольник тупоугольный');
Readkey;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment