wtite a program that will multiply two integers in recursion
function

Answers were Sorted based on User's Feedback



wtite a program that will multiply two integers in recursion function..

Answer / 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

wtite a program that will multiply two integers in recursion function..

Answer / mohit taneja

int mul(int n)
{
static int num;
printf("enter the number");
scanf("%d",&num);
if(n==1)
{
return num;
}
else
{
num=num*mul(n-1);
}
return num;
}

void main()
{
int n,result;
printf("enter the number of digit u want to multiply");
scanf("%d",&n);
int result=mul(n);
printf("multiplication=%d",result);
getch();
}

Is This Answer Correct ?    13 Yes 22 No

wtite a program that will multiply two integers in recursion function..

Answer / der

#include<iostream.h>
void main()
{clrscr();
int x,y,sum;
sum=x+y;
cout<<sum;
getch();
}

Is This Answer Correct ?    0 Yes 9 No

wtite a program that will multiply two integers in recursion function..

Answer / matloob

void main()
{
int a,b,c;
c=a*b;
getch
}

Is This Answer Correct ?    3 Yes 17 No

Post New Answer

More C Interview Questions

Do array subscripts always start with zero?

0 Answers  


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

0 Answers  


Determine the code below, tell me exactly how many times is the operation sum++ performed ? for ( i = 0; i < 100; i++ ) for ( j = 100; j > 100 - i; j--) sum++;

5 Answers   ITCO, Wipro,


What are unions in c?

0 Answers  


write a c program that prints all multiples of 3between 1 and 50.

5 Answers  


What is the difference between text and binary modes?

0 Answers  


Which is best linux os?

0 Answers  


Write a program to generate the first n terms in the series --- 2,3,5,7,11,...,17

0 Answers  


What is Function Pointer? Explain with example?

3 Answers  


Who invented b language?

0 Answers  


10. Study the code: void show() main() { show(); } void show (char *s) { printf("%sn",s); } What will happen if it is compiled & run on an ANSI C Compiler? A)It will compile & nothing will be printed when it is executed B)it will compile but not link C)the compiler will generate an error D)the compiler will generate a warning

5 Answers   Accenture,


hi , please send me NIC written test papers to sbabavalli@gmail.com

0 Answers   NIC,


Categories