Skip to content
doubtly

1 answer

Best answer

#include <iostream>  

using namespace std;  

int main()  

{  

  int i,fact=1,number;    

  cout<<"Enter any positive Number: ";    

  cin>>number;    

  for(i=1;i<=number;i++)

  {    

      fact=fact*i;  //for 5! = 5*4*3*2*1  

  }    

  cout<<"Factorial of entered number" <<number<<" is: "<<fact<<endl;  

  return 0;  

}  


Output::
image

Doubtly · 8 Nov 2021 Report
Was this answer helpful?

Your answer

Log in or create a free account to answer this question.