Hard
Debugging Helper
Identify logical errors or bugs in a code snippet and propose a fix.
📝 Treść promptu
Analyze the following code snippet which is intended to calculate the factorial of a number but is producing incorrect results. Identify the bug, explain why it is happening, and provide the corrected code.