text: Counts paths from a point to reach Origin | C ++ Program for above approach ; Function to find binomial Coefficient ; Constructing Pascal 's Triangle ; Driver Code
code: #include <iostream> NEW_LINE #include <bits/stdc++.h> NEW_LINE using namespace std ; int binomialCoeff ( int n , int k ) { int C [ k + 1 ] ; memset ( C , 0 , sizeof ( C ) ) ; C [ 0 ] = 1 ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = min ( i , k ) ; j > 0 ; j -- ) C [ j ] = C [ j ] + C [ j - 1 ] ; } return C [ k ] ; } int main ( ) { int n = 3 , m = 2 ; cout << " Number ▁ of ▁ Paths : ▁ " << binomialCoeff ( n + m , n ) << endl ; return 0 ; }