SCHOOL OF CODE BUILDERS
Learn To CODE. Become A DEVELOPER.
Pages
HOME
DATA STRUCTURES
STRINGS
ARRAYS
MATRIX
BINARY TREES
LINKED LIST
STACK
QUEUE
SORTING
SEARCHING
C
PYTHON
PSEUDOCODE
CONTEST PROBLEMS
ALGORITHMS
PATTERNS
PHP
C PUZZLES
C INTERVIEW QUESTIONS
JAVA
C++
HASHING
RECURSION
BASIC C PROGRAMS
TCS-CODEVITA
FACEBOOK
CONTACT US
C program to find factorial of a number using for loop
C program to find factorial of a number using for loop
Output:
Enter a number to find its factorial:
5
The factorial of 5 is 120
Implementation:
#include
int main(void) { int n,i=2,fact=1; printf("Enter a number to find its factorial:\n"); scanf("%d",&n); for(i=2;i<=n;fact*=i,i++); printf("The factorial of %d is %d",n,fact); return 0; }
PREVIOUS
NEXT
HOME