using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _3jiao_xing
{
class Program
{
static void Main(string[] args)
{
double a,b,c; //边长
Console.WriteLine("输入边长a");
a=Convert.ToDouble(Console. ReadLine());
Console.WriteLine("输入边长b");
b=Convert.ToDouble(Console. ReadLine());
Console.WriteLine("输入边长c");
c=Convert.ToDouble(Console. ReadLine());
if (a<=0||b<=0||c<=0) //防止输入错误数值
{
Console.WriteLine("输入错误");
Console.Read();
}
if (a + b > c && a + c > b && b + c > a) //判断是否为三角形
{
if (a == b && b == c)
{ Console.WriteLine("是等边三角形");
Console.Read(); }
else if (a == b || b == c || a == c)
{ Console.WriteLine("是等腰三角形");
Console.Read(); }
else if ((a * a) + (b * b) == (c * c) || (a * a) + (c * c) == (b * b) || (b * b) + (c * c) == (a * a))
{
{
Console.WriteLine("是直角三角形");
Console.Read();
}
if (a == b || b == c || a == c)
{
Console.WriteLine("是等腰直角三角形");
Console.Read();
}
}
else
{
Console.WriteLine("是任意三角形");
Console.Read();
}
}
else
{
Console.WriteLine("输入的三边不能组成三角形");
Console.Read();
}
}
}
}
三角形
最新推荐文章于 2022-12-03 15:16:35 发布