Check whether the triangle is valid or not if angles are given | Java program to check validity of any triangle ; Function to check if sum of the three angles is 180 or not ; check condition ; Driver Code ; function calling and print output
class GFG { public static int Valid ( int a , int b , int c ) { if ( a + b + c == 180 && a != 0 && b != 0 && c != 0 ) return 1 ; else return 0 ; } public static void main ( String args [ ] ) { int a = 60 , b = 40 , c = 80 ; if ( ( Valid ( a , b , c ) ) == 1 ) System . out . print ( " Valid " ) ; else System . out . print ( " Invalid " ) ; } }