Check whether the triangle is valid or not if angles are given | C ++ implementation of the approach ; Function to check if sum of the three angles is 180 or not ; Check condition ; Driver code ; function call ing and print output
#include <bits/stdc++.h> NEW_LINE using namespace std ; bool Valid ( int a , int b , int c ) { if ( a + b + c == 180 && a != 0 && b != 0 && c != 0 ) return true ; else return false ; } int main ( ) { int a = 60 , b = 40 , c = 80 ; if ( Valid ( a , b , c ) ) cout << " Valid " ; else cout << " Invalid " ; }