Computer Science, asked by ammukutty1522, 1 year ago

write a c++ program to find the factorial of any given number​

Answers

Answered by anabiyamalik307
1

Answer:

#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;  

}  

Explanation:

Answered by sougatap57
0

Answer:

#include <iostream>

using namespace std;

int main()

{

  int n1,fact=1,i;

  cout<<"enter the range of the factorial";

  cin>>n1;

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

  {

      fact=fact*i;

  }

   cout<<"the factorial is ="<<fact;  

  return 0;

}

Output

enter the range of the factorial 6

the factorial is 720

Similar questions