Factorial of a number using Recursion
Factorial of a number using Recursion
#include <stdio.h>
//Function Prototype Declaration
int factorial (int a);
int main() {
int num;
printf(“Enter the number : “);
scanf(“%d”,&num);
int fact = factorial(num); //Function Calling
printf(“The factorial of %d is %d”,num ,fact);
return 0;
}
//Function
int factorial (int a){
int result;
if (a==1) return 1;
result = a * factorial(a-1); //Recursive Function
return result;
}
Topics Covered :
- factorial
- factorial of a number
- recursion
- user input number
- c programming
- logic
Thanks for reading this blog. Hope you get satisfied with the blog and definitely this blog must have valued your time and effort of reading.
Take a time to connect our other digital creations such as Instagram , Facebook and Youtube.
Social Media Links of Tech DCode :
YouTube : https://www.youtube.com/channel/UCjJnEdeugftBwQ3yMuD4B_A
Instagram : https://www.instagram.com/thetechdcode/
Facebook Page : https://www.facebook.com/thetechdcode
Twitter : https://twitter.com/thetechdcode
Telegram Channel : https://t.me/thetechdcode
Tech DCode Linktree : https://linktr.ee/thetechdcode
My Personal Handles : https://linktr.ee/virtualshivamin
Social Media Links of SHIVAM SINGH (OWNER) :
Instagram : https://www.instagram.com/virtualshivamin/
Facebook Page : https://www.facebook.com/virtualshivamin/
Twitter : https://twitter.com/virtualshivamin/
Personal Linktree : https://linktr.ee/virtualshivamin