using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int a, b, c;
Console.WriteLine("请输入第一条边的值");
a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("请输入第二条边的值");
b = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("请输入第三条边的值");
c = Convert.ToInt32(Console.ReadLine());
if (a + b > c && a + c > b && b + c > a)
{
Console.WriteLine("可以组成三角形");
if (a == b && b == c)
Console.WriteLine("是等边三角形");
else
if (a == b || b == c || a == c)
Console.WriteLine("是等腰三角形");
else if (a * a + b * b == c * c || a * a + c * c == b * b || b * b + c * c == a * a)
Console.WriteLine("可以构成直角三角形");
}
else
Console.WriteLine("输入的三边不能构成三角形");
Console.ReadKey();
//关于这次的编程,我学会用了&&,||
}
}
}
有什么可以改进的地方,请提出来,谢谢你们的帮忙和意见
最新推荐文章于 2023-03-19 18:53:21 发布