Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.4 kB
2
Indexable
Never
using System;

public static class Triangle
{
    private static double a;
    private static double b;
    private static double c;

    public static bool isTriangle(double a, double b, double c)
    {
        if (a > 0 && b > 0 && c > 0 && a + b >= c && b + c >= a && a + c >= b)
        {
            return true;
        }
        return false;
    }
    public static bool IsScalene(double side1, double side2, double side3)
    {
        bool isScalene = false;
        if (isTriangle(side1, side2, side3))
        {
            if (side1 != side2 && side2 != side3 && side1 != side3)
            {
                isScalene = true;
            }
        }
        return isScalene;
    }

    public static bool IsIsosceles(double side1, double side2, double side3)
    {
        bool isIsoscles = false;
        if (isTriangle(side1, side2, side3))
        {
            if (side1 == side2 || side2 == side3 || side3 == side1)
            {
                isIsoscles = true;
            }
        }
        return isIsoscles;

    }

    public static bool IsEquilateral(double side1, double side2, double side3)
    {
        bool isEquilateral = false;
        if (isTriangle(side1, side2, side3))
        {
            if (side1 == side2 && side1 == side3 && side2 == side3)
            {
                isEquilateral = true;
            }
        }
        return isEquilateral;
    }
}