64 lines
1.2 KiB
C#
Raw Normal View History

2021-09-02 08:31:01 -03:00
using System;
namespace exercicios
{
class Exercicio4{
public static void Init()
{
double a,b,c;
Console.WriteLine("Insert the triangle's dimensions (A,B,C)");
a = double.Parse(Console.ReadLine());
b = double.Parse(Console.ReadLine());
c = double.Parse(Console.ReadLine());
if(a < (b+c) && b < (a+c) && c < (a+b))
{
Console.WriteLine(TriEquil(a,b,c) == true ?
"Equilateral" : TriIso(a,b,c) == true ?
"Isosceles" : TriEsc(a,b,c) == true ?
"Scalene" : "N. A.");
}
else
{
Console.WriteLine("Not a triangle.");
}
}
static bool TriEquil(double a, double b, double c)
{
if (a == b && b == c)
{
return true;
}
else
{
return false;
}
}
static bool TriIso(double a, double b, double c)
{
if (a == b || a == c || b == c)
{
return true;
}
else
{
return false;
}
}
static bool TriEsc(double a, double b, double c)
{
if((TriIso(a,b,c) && TriEquil(a,b,c)) == false)
{
return true;
}
else {return false;}
}
}
}