Computer Science, asked by shambhaviagrahari1, 6 months ago

java program to input the sides of a triangle and check whether the triangle are possible or not. if possible then display whether it is equilateral, isolat, oscillin or display triangle not possible ​

Answers

Answered by vivek7618
1

Answer:

yes it is valid

Explanation:

1.a + b > c 2.a + c > b 3.b + c > a



C++

Java

// Java program to check 

// validity of any triangle

  

public class GFG {

  

  

    // Function to calculate for validity

    public static int checkValidity(int a,

                                int b, int c)

    {

        // check condition

        if (a + b <= c || a + c <= b || b + c <= a)

            return 0;

        else

            return 1;

    }

  

    // Driver function

    public static void main(String args[])

    {

  

        int a = 7, b = 10, c = 5;

      

        // function calling and print output

        if ((checkValidity(a, b, c)) == 1)

            System.out.print("Valid");

        else

            System.out.print("Invalid");

          

    }

}

  

// This article is contributed by 'Akansh Gupta'

Similar questions