first commit
This commit is contained in:
63
listas3/source/exercicio4.cs
Normal file
63
listas3/source/exercicio4.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
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;}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user