0
Recursion multiplication in Java
I need help in this question!! Write a recursive function that accepts two arguments into the parameters x and y. The function should return the value of x times y. Ex: 7 * 4 4+4+4+4+4+4+4=28
2 Answers
+ 2
int multiply(int x, int y) {
if(y == 0)
return 0;
return x + multiply(x, y-1);
}
+ 1
Ashish Anand thank you so much