[PR #1351] [CLOSED] Factorial #1951

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

📋 Pull Request Information

Original PR: https://github.com/TheAlgorithms/C/pull/1351
Author: @Aditya-Ghosh-27
Created: 10/14/2023
Status: Closed

Base: masterHead: factorial


📝 Commits (2)

  • a63c6d5 Factorial program using recursion
  • fe4d867 Factorial program in C using recursion

📊 Changes

1 file changed (+19 additions, -0 deletions)

View changed files

math/factorialrecursion.c (+19 -0)

📄 Description

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); }


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/TheAlgorithms/C/pull/1351 **Author:** [@Aditya-Ghosh-27](https://github.com/Aditya-Ghosh-27) **Created:** 10/14/2023 **Status:** ❌ Closed **Base:** `master` ← **Head:** `factorial` --- ### 📝 Commits (2) - [`a63c6d5`](https://github.com/TheAlgorithms/C/commit/a63c6d5389407cc7acf06e5c4ea7bffa3df16cf8) Factorial program using recursion - [`fe4d867`](https://github.com/TheAlgorithms/C/commit/fe4d867909a4169b9c6262b83d841bafd7361b02) Factorial program in C using recursion ### 📊 Changes **1 file changed** (+19 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `math/factorialrecursion.c` (+19 -0) </details> ### 📄 Description **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); } ` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 15:26:40 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/C#1951