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 for factorial
c++ program for factorial
Output:
Enter a number to find its factorial:
5
The factorial of 5 is 120
Implementation:
#include
using namespace std; int main() { int n; cout<<"enter a number to find its factorial"<
>n; int fact=1; for(int i=2;i<=n;i++) { fact*=i; } cout<<"The factorial of "<< n <<" is "<< fact <
PREVIOUS
NEXT
HOME