0
How to get the factorial of any number without using * (multiplication) operator?
Developed program in any language to get the factorial of any number but without using multiplication (*) operator.
3 Antworten
0
In Python 3,
fac = lambda x: 1 if x == 1 else sum([x for i in range(fac(x-1))])
print(fac(5))
Output:
120
Note:
I don't take credit for this. I codegolfed code I found on Stack Overflow https://stackoverflow.com/questions/28005700/how-can-i-make-a-recursive-factorial-without-using-multiplication
0
replace n*x with n times of +x
0
Check this
https://code.sololearn.com/cKWo4Cc0GKd1