Guest User

Untitled

a guest
Aug 14th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. function res = recursiveProduct(int1,int2)
  2. if int1==0 | int2==0
  3. res=0
  4. elseif int1==1
  5. res=int2
  6. elseif int2==1
  7. res=int1
  8. elseif int1==-1
  9. res=-int2
  10. else
  11. res=recursiveProd(int1,int2)
  12. end
  13. end
  14.  
  15.  
  16. function res=recursiveProd(int1,int2)
  17. if int2 == 0
  18. res = 0;
  19. else
  20. res = int1 + recursiveProduct(int1, int2 - 1);
  21.  
  22. end
Add Comment
Please, Sign In to add comment