Number of compositions of a natural number | C ++ program to find the total number of compositions of a natural number ; Return 2 raised to power ( n - 1 ) ; Driver Code
#include <iostream> NEW_LINE using namespace std ; #define ull  unsigned long long NEW_LINE ull countCompositions ( ull n ) { return ( 1L ) << ( n - 1 ) ; } int main ( ) { ull n = 4 ; cout << countCompositions ( n ) << " STRNEWLINE " ; return 0 ; }