C++ Program To Find Factorial
belongs to collection: Simple 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
57133839564458545904789328652610540031895535786011264182548375833179
82912484539839312657448867531114537710787874685420416266625019868450
446635594919592206657494259209573577892932535729044496247240541679072
2118445437122269675520000000000000000000000000000000000000
need an explanation for this answer? contact us directly to get an explanation for this answer