Multiplication of two Numbers without using * operator recursion c++

#include<iostream.h>
#include<conio.h>
int rec (int,int);
int main()
{
int i,a,b;
cout<<" enter the 1st Number : ";
cin>>a;
cout<<" enter the 2nd Number : ";
cin>>b;
cout<<"\n\n\n\n MuLtiplication of No's without Using * operator : ";
     cout<< rec(a,b);
     cout<<"\n\n\n\n";
}
int rec ( int a , int b)
{

     if ( b > 1)
       {
           return a+rec(a,b-1);
       } 
   
     else
        {
       return a ;
        }
}


output :

SHARE

Milan Tomic

Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment