This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: return 0; else return -1 + mystery( a + b, b); //recursive case } } } Q3. Write a method that will recursively fill an array with data according to its position in the array. As a hint, here is the method header to start you off: int fill_array(int array[ ], int size) Q4. Using recursion, write a method that given 2 numbers, x and y will get the multiple of the 2 numbers. If you want to keep it simple you can assume that the numbers entered will always be positive. Q5. If you want extra practice with recursion, try writing the factorial method we did in class without looking at the solution in the notes. Remember: factorial n! is defined as n! = 1 if n = 0 n * (n-1)! if n > 0...
View Full Document
- Spring '10