Check whether triangle is valid or not if sides are given | C ++ program to check if three sides form a triangle or not ; function to check if three sider form a triangle or not ; check condition ; Driver function ; function calling and print output
#include <bits/stdc++.h> NEW_LINE using namespace std ; bool checkValidity ( int a , int b , int c ) { if ( a + b <= c a + c <= b b + c <= a ) return false ; else return true ; } int main ( ) { int a = 7 , b = 10 , c = 5 ; if ( checkValidity ( a , b , c ) ) cout << " Valid " ; else cout << " Invalid " ; }