Home C Factorial of a number in C Programming Factorial of a number in C Programming / August 03, 2017 Factorial of a number in C Programming Code: #include<stdio.h> int factorial(int n); int main() { int n,f; scanf("%d",&n); f=factorial(n); printf("%d",f); return 0; } int factorial(int n) { int i,sum=1; for(i=1;i<=n;i++) { sum=sum*i; } return sum; }
No comments