mirror of
https://github.com/TheAlgorithms/C.git
synced 2026-04-21 21:09:36 +00:00
[PR #1351] [CLOSED] Factorial #1951
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/TheAlgorithms/C/pull/1351
Author: @Aditya-Ghosh-27
Created: 10/14/2023
Status: ❌ Closed
Base:
master← Head:factorial📝 Commits (2)
a63c6d5Factorial program using recursionfe4d867Factorial 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.