For a small assignment, I have to write a function which takes in one integer as an input and should return the multipled total of everything before that number. For example;
It should do and return the following:
9*8*7*6*5*4*3*2*1 = 3628800
Seems easy enough, right? Well. We've been imposed limitations on the tools we can and can't use. We cannot use while and for loops, we have to only supply one parameter into the function and we can only pass in actual values as parameters, not references. AND we cannot have global variables.
I thought a simple way of doing this would be to have a recursive function, but as I started doing that I found too many limitations to that method and perhaps because of my coding ability I wasn't able to follow it through because two counts will need to be retained:
One decrementing count which is 10, 9, 8, 7 and so on..., then another number which holds the previous multiplied amounts like 10*9 = 90 and as I said, only one parameter is allowed here.
Is there an obvious thing I'm missing here?