Find m | CPP program to find m - th summation ; Function to return mth summation ; base case ; driver program
#include <bits/stdc++.h> NEW_LINE using namespace std ; int SUM ( int n , int m ) { if ( m == 1 ) return ( n * ( n + 1 ) / 2 ) ; int sum = SUM ( n , m - 1 ) ; return ( sum * ( sum + 1 ) / 2 ) ; } int main ( ) { int n = 5 ; int m = 3 ; cout << " SUM ( " << n << " , ▁ " << m << " ) : ▁ " << SUM ( n , m ) ; return 0 ; }