+ 1
How user defined function is working
mainly fr finding factorial of a number
1 Answer
+ 2
In the code inserted, suppose, you give 3 as input. Since 3>0, the code returns 3*fact(2). Again, fact(2) returns 2*fact(1). fact(1) returns 1*fact(0). So the final result is 3*2*1*fact(0). But fact(0)=1. So the function finally returns 6.
https://code.sololearn.com/cDO15j6FTfpn/?ref=app