C++ Program To Find Factorial
belongs to collection: Loop Programs In C ++Programming
All Answers
need an explanation for this answer? contact us directly to get an explanation for this answer
Factorial Using For Loop
#include<iostream>
using namespace std;
int main()
{
unsigned long long int fact=1;
int i,num;
cout<<"Enter The Number. You Want Factorial:";
cin>>num;
for(i=1;i<=num;i++)
{
fact=fact*i;
}
cout<<"\nFactorial of "<<num<<" Is = "<<fact<<endl;
return 0;
}
Output:
Enter The Number. You Want Factorial:6
Factorial of 6 Is = 720
need an explanation for this answer? contact us directly to get an explanation for this answertotal answers (2)
Factorial For Large Number Using Array
Output:
Enter The Number
150
5713383956445854590478932865261054003189553578601126418254837583317
9829124845398393126574488675311145377107878746854204162666250198684
5044663559491959220665749425920957357789293253572904449624724054167
90722118445437122269675520000000000000000000000000000000000000
need an explanation for this answer? contact us directly to get an explanation for this answer