Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

wtite a program that will multiply two integers in recursion
function

Answer Posted / shruthi.k.a

multiplication of two numbers say 2*3 is similar to adding
the first number the second number of times(i.e in our
example 2+2+2 will give 2*3)
hence,


int add(int m,int n)
{
static int res;
if(n==1)
return m;
else
res=m+add(m,n);
printf("%d\n",res);
return ;
}

int main()
{
int m,n;
printf("enter the two numbers\n");
scanf("%d%d",&m,&n);
add(m,n);
return 0;
}

Is This Answer Correct ?    16 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?

1584


What is the data segment that is followed by c?

1031


How arrays can be passed to a user defined function

966


write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3

2030


What type of function is main ()?

996


Why should I use standard library functions instead of writing my own?

1205


what is ur strangth & weekness

2329


Why dont c comments nest?

999


What is file in c language?

963


What is the difference between local variable and global variable in c?

1163


Write a program with dynamically allocation of variable.

1067


What is the equivalent code of the following statement in WHILE LOOP format?

1247


What is the role of this pointer?

993


Explain what happens if you free a pointer twice?

1015


What do header files do?

1019