```python
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1)
# 测试代码
print(factorial(5)) # 输出: 120
```
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1)
# 测试代码
print(factorial(5)) # 输出: 120
```