1.编程(pascal):输入三角形的三个边,判断它是何类型的三角形(等边三角形?等腰三角形?一般三角形?)

来源:百度知道 编辑:UC知道 时间:2024/06/19 05:00:14

以下程序在DELPHI下调试通过。

{$apptype console}
program exp;
var a,b,c:integer;
begin
  readln(a,b,c);
  if (a=b) and (b=c) then write('等边三角形')
  else if (a=b) or (a=c) or (b=c) then write('等腰三角形')
  else write('一般三角形')
end.

{$apptype console}
program exp;
var a,b,c:integer;
begin
readln(a,b,c);
if (a+b>c)and(a+c>b)and(c+b>a) then begin{判断是否任意两边之和都大于第三边,否则不是三角形!}
if (a=b) and (b=c) then write('等边三角形')
else if (a=b) or (a=c) or (b=c) then write('等腰三角形')
else write('一般三角形')
end else write('不是三角形')
end.

program exp;
var a,b,c:integer;
begin
readln(a,b,c);
if (a=b) and (b=c) then write('等边')
else if (a=b) or (a=c) or (b=c) then write(