[PR #1351] Factorial #1956

Open
opened 2026-01-29 15:26:43 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/TheAlgorithms/C/pull/1351

State: closed
Merged: No


Title:
Factorial program in C using recursion

Solved #1326

Description:
This program implements a function named factorial which computes the factorial of a number with a O(n) time complexity.

Why is this PR needed?
The other solutions does the job but they are not using recursion as clearly mentioned in the issues. My solution uses recursion and thus is maintaining the criteria of the issue.

My solution:
int factorial(int n) { if(n == 0) return 1; else return n * factorial(n-1); }

**Original Pull Request:** https://github.com/TheAlgorithms/C/pull/1351 **State:** closed **Merged:** No --- **Title:** Factorial program in C using recursion Solved #1326 ***Description:*** This program implements a function named factorial which computes the factorial of a number with a O(n) time complexity. **Why is this PR needed?** The other solutions does the job but they are not using recursion as clearly mentioned in the issues. My solution uses recursion and thus is maintaining the criteria of the issue. **My solution:** ` int factorial(int n) { if(n == 0) return 1; else return n * factorial(n-1); } `
claunia added the pull-request label 2026-01-29 15:26:43 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/C#1956