C Program To Calculate Factorial Of A Number Using Recursion
/* Source code to find factorial of a number. */ #includeint factorial(int n); int main() { int n; printf("Enter an positive integer: "); scanf("%d",&n); printf("Factorial of %d = %ld", n, factorial(n)); return 0; } int factorial(int n) { if(n!=1) return n*factorial(n-1); } Output Enter an positive integer: 6 Factorial of 6 = 720
EmoticonEmoticon