From 5e09dac8624fb6e461ee1227754dc2ffe207a8d3 Mon Sep 17 00:00:00 2001 From: Akash Kumar Gupta <96005719+imakashkrgupta@users.noreply.github.com> Date: Wed, 19 Oct 2022 20:39:10 +0530 Subject: [PATCH] Create factorial_using_recursion.c --- factorial_using_recursion.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 factorial_using_recursion.c diff --git a/factorial_using_recursion.c b/factorial_using_recursion.c new file mode 100644 index 0000000..f63a41d --- /dev/null +++ b/factorial_using_recursion.c @@ -0,0 +1,20 @@ +#include + int factorial(int number){ + if (number==1 || number==0) + { + return 1; + } + else{ + return (number * factorial (number-1)); + } + } + + int main() + { + int a; + printf("Enter a Number To Find The Factorial: "); + scanf("%d", &a); + printf("The Factorial of %d is %d", a, factorial(a)); + return 0; + + }