I'm trying to create a small program that allows a user to input an integer which will output the product such as follows:
For example:
a = 5, 5*4*3*2 = 120
a = 4, 4*3*2*1 = 24
a = 3, 3*2*1 = 6
Can someone provide guidance as I'm stuck on how to frame this more efficiently. If using Python, I would probably write the logic something like:
def a(num):
x = 1
for i in range (num):
x=x*(i + 1)
return x
print a(5)