Search This Blog

Read Your Language

Write the Factorial Program in C++.




Write the Factorial Program  in C++.



We knows that factorial no is the self divided or only 1. Factorial no  is find the C++ you have three variable.
1) Ist variable is fact=1 because factorial no has  last no is the 1.
2) 2nd variable is User defiend input  n numbers. 
3) 3rd variable is  i number has factorial increment of the numbers .


/*  Write the Factorial Program  in C++ */

#include<iostream>
using namespace std;
main()
{
int fact=1,i,n;
cout<<"Enter the factorial no is :"<<endl;
cin>>n;
for(i=1;i<=n;i++)
fact=fact*i;
cout<<"your  Enter factorial "<<n<<" is the :"<<fact;
}

OUTPUT:

Enter the factorial no is :
4
your  Enter factorial 4 is the : 24

No comments:

Contact Form

Name

Email *

Message *

Followers