I am trying to build a program which calculates the factorial of number num1
. The question is: how can I multiply all the digits in i
?
Here I have used a for
loop for generating numbers backward from 5: 5,4,3,2,1,0
But is there any way I can multiply all the digits of the variable i
?
for i in range(0,5,-1):
print(i)
The result was as follows:
5
4
3
2
1
Is there any way I can get the product of the numbers. I expect the output to be 120
.