text: Count of ways to split N into Triplets forming a Triangle | C # Program to implement the above approach ; Function to return the required number of ways ; Check if a , b , c can form a triangle or not ; Return number of ways ; Driver Code
code: using System ; class GFG { static int Numberofways ( int n ) { int count = 0 ; for ( int a = 1 ; a < n ; a ++ ) { for ( int b = 1 ; b < n ; b ++ ) { int c = n - ( a + b ) ; if ( a + b > c && a + c > b && b + c > a ) { count ++ ; } } } return count ; } static public void Main ( ) { int n = 15 ; Console . WriteLine ( Numberofways ( n ) ) ; } }