Multiply two numbers using Recursion

This program is to multiply two numbers using Recursive function.



#include <iostream>

using namespace std;
int Multiply(int a,int b,int i)
{

    if(i==b)
    {
        return a*i;
    }
    int y=Multiply(a,b,i+1);
    return y;
}



int main()
{
    int a,b;
    cin>>a>>b;
    int y=Multiply(a,b,1);
    cout<<y;


}

Comments

Popular posts from this blog