Eesh, a bit of head scratching and then a while after these were the possibilities
- Use a while loop to iterate over one of the values
- Use a for loop to iterate over one over the values
- Use recursion to call yourself until a drop-out condition occurs
Other things to think about
- Negative numbers. If one number is negative then the returning value will be negative. If both are negative or both positive then return positive
- Iterate over the smallest number to be more efficient
No comments:
Post a Comment