wtite a program that will multiply two integers in recursion
function
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
if we take a number as a char then can we manipulate(add, subtract) on this number
for questions 14,15,16,17 use the following alternatives:a.int b.char.c.string.d.float
What does 2n 4c mean?
I didn't count the ducks that I saw in line, but I do remember that one duck was in front of two ducks, another duck behind two ducks. How many ducks did I see?
main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }
Write a program for Overriding.
what do you mean by inline function in C?
We can draw a box in cprogram by using only one printf();& without using graphic.h header file?
Find if a number is power of two or not?
How do I create a directory? How do I remove a directory (and its contents)?
what is memory leak?
How can I split up a string into whitespace-separated fields?