Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

FACTORIAL IN C++

#include <iostream>  
using namespace std;  
int main()  
{  
   int i,fact=1,number;    
  cout<<"Enter any Number: ";    
 cin>>number;    
  for(i=1;i<=number;i++){    
      fact=fact*i;    
  }    
  cout<<"Factorial of " <<number<<" is: "<<fact<<endl;  
  return 0;  
}  
 
PREVIOUS NEXT
Tagged: #FACTORIAL #IN
ADD COMMENT
Topic
Name
2+2 =