Answers for "factorial function best c++"

C++
0

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;  
}
Posted by: Guest on February-18-2022

Code answers related to "factorial function best c++"

Browse Popular Code Answers by Language