Write a recursive method named diceRolls
accepts an integer representing a number of 6-sided dice to roll, and output all possible combinations of values that could appear on the dice.
For example, the call of diceRolls(3);
should print:
[1, 1, 1]
[1, 1, 2]
[1, 1, 3]
[1, 1, 4]
[1, 1, 5]
[1, 1, 6]
[1, 2, 1]
[1, 2, 2]
...
[6, 6, 4]
[6, 6, 5]
[6, 6, 6]
If the number of digits passed is 0 or negative, print no output.
Your method must use recursion, but you can use a single for
loop if necessary.