The following code finds out the factorial of a number. There is some error in it.
#include
int main ()
{
long number;
std::cin>>number;
std::cout<< factorial (number);
return 0;
}
long factorial (long a);
{
for(int i=1;i<=a;i++)
fact=fact*i;
}
Answers
Answered by
1
Answer:
using namespace std
Explanation:
#include <iostream>
int main()
{
int n=5, fact=1,i;
for(i=1; i<=n;i++)
fact = fact * i;
cout<<"Factorial of "<<n<<" is "<<fact;
return 0;
}
For this the output is 120
Similar questions