Give a recursive algorithm that takes as input two positive integers x and y and returns the product of x and y. The only arithmetic operations your algorithm can perform are addition or subtraction. Furthermore, your algorithm should have no loops.

Respuesta :

Answer:

#include <stdio.h>

int product(int x,int y)

(

 if(y==1)

    return x;

 else

    return (x+product(x,y-1));

)

int main()

(

 int a,b;

 scanf("%d %d",&a,&b);

 printf("%d\n*,product(a,b));

return 0;

)

Explanation:

See above code as explanatory enough.