Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function res = recursiveProduct(int1,int2)
- if int1==0 | int2==0
- res=0
- elseif int1==1
- res=int2
- elseif int2==1
- res=int1
- elseif int1==-1
- res=-int2
- else
- res=recursiveProd(int1,int2)
- end
- end
- function res=recursiveProd(int1,int2)
- if int2 == 0
- res = 0;
- else
- res = int1 + recursiveProduct(int1, int2 - 1);
- end
Add Comment
Please, Sign In to add comment