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 without using recursion
C program to find factorial of a number without using recursion
Output:
Enter a number to get its factorial: 5
Factorial of 5 is 120
Implementation:
#include
int main(void) { int n,i=2,fact=1; printf("Enter a number to get its factorial:\n"); scanf("%d",&n); while(i<=n) { fact *= i; i++; } printf("Factorial of %d is %d",n,fact); return 0; }
PREVIOUS
NEXT
HOME