Asked by
AL MaMun (4 Golds)
Friday, 31 Jul 2020, 04:12 PM
at (Education
Tutorials)
|
|
|
|
A C program to find factorial using recursion. #include<stdio.h> int factorial(int n) { if(n==0) return 1; else return n*factorial(n-1); } int main() { int n, result; printf("Enter a positive integer: \n"); scanf("%d", &n); if(n>=0) { result=factorial(n); printf("Factorial = %d", result); } else printf("Please Enter a positive Integer! "); return 0; } |