You are on page 1of 1

Recursive Programming Problem

Write a JAVA program that repeatedly prompts your user for a number, uses
a recursive function to calculate the product of that number times three (3),
and displays the product. Select a sentinel value that allows your user to
quit. Do NOT use the multiplication operator (*) in your proposed solution.

User Inputs: Recursive Function Returns:


-2 -6
-1 -3
0 0
1 3
2 6
3 9
4 12

Hint: Think of multiplication as a series of additions.

Recursive Function
User Inputs: Performs: Returns:
1 3 3
2 3+3 6
3 3+3+3 9
4 3+3+3+3 12

You might also like