三角形类型判断
来源:互联网 发布:2017淘宝处罚考试答案 编辑:程序博客网 时间:2024/05/23 11:49
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication34
{
class Program
{
static void Main(string[] args)
{
double a = 0, b = 0, c = 0;
string result = "";
Console.WriteLine("请输入三条边的边长,以回车为间隔");
a = double.Parse(Console.ReadLine());
b = double.Parse(Console.ReadLine());
c = double.Parse(Console.ReadLine());
if (a + b > c && a + c > b && b + c > a)
{
if (a == b && b == c) result = "等边";
else if (a == b || a == c || b == c)
{
result = "等腰";
if (a * a + b * b == c * c || a * a + c * c == b * b || b * b + c * c == a * a) result += "直角";
}
else if (a * a + b * b == c * c || a * a + c * c == b * b || b * b + c * c == a * a) result = "直角";
else result = "任意";
}
else result = "非";
Console.Clear();
Console.WriteLine("边长为{0},{1},{2}的三条边构成\n{3}三角形", a, b, c, result);
Console.ReadLine();
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication34
{
class Program
{
static void Main(string[] args)
{
double a = 0, b = 0, c = 0;
string result = "";
Console.WriteLine("请输入三条边的边长,以回车为间隔");
a = double.Parse(Console.ReadLine());
b = double.Parse(Console.ReadLine());
c = double.Parse(Console.ReadLine());
if (a + b > c && a + c > b && b + c > a)
{
if (a == b && b == c) result = "等边";
else if (a == b || a == c || b == c)
{
result = "等腰";
if (a * a + b * b == c * c || a * a + c * c == b * b || b * b + c * c == a * a) result += "直角";
}
else if (a * a + b * b == c * c || a * a + c * c == b * b || b * b + c * c == a * a) result = "直角";
else result = "任意";
}
else result = "非";
Console.Clear();
Console.WriteLine("边长为{0},{1},{2}的三条边构成\n{3}三角形", a, b, c, result);
Console.ReadLine();
}
}
}
0 0
- 判断三角形类型
- 判断三角形类型
- 判断三角形类型
- 判断三角形类型
- 程序设计:三角形类型判断
- 作业-三角形类型判断
- 三角形的判断类型
- 三角形类型判断
- 三角形类型的判断
- 三角形类型判断
- 判断三角形类型
- 判断三角形的类型
- 三角形类型判断
- 判断三角形的类型
- 判断三角形类型
- 1164 -- 判断三角形类型
- 判断三角形类型 018
- 判断三角形的类型
- CListCtrl
- putty
- android客户端从服务器端获取json数据并解析的实现代码
- java关键字final与static总结
- Android中visibility属性VISIBLE、INVISIBLE、GONE的区别
- 三角形类型判断
- 解决yum安装出现错误:Cannot retrieve metalink for repository: epel. Please verify its path and try again
- Linux之grep命令
- linux write函数是否原子操作
- Linux下使用有那(挂载)centos , ubuntu
- NYOJ A+B Problem(V)
- 为什么使用BeagleBone BeagleBone的优点
- Mac系统显示或隐藏文件夹的方法
- 5种将死的编程语言