#include <iostream>
using namespace std;

int total_paths(int m,int n){
    if(m==1 || n==1){
        return 1;
    }
    return total_paths(m-1,n) + total_paths(m,n-1); // + total_paths(m-1,n-1);
         //row wise             column wise          diagonal wise 
}

int main() {
    int m,n;
    cin>>m>>n;
    int ans = total_paths(m,n);
    cout<<ans<<"\n";
    return 0;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: