+ 6
Write a program to get factorial of a given number using for loop.
2 Answers
+ 12
#include <iostream>
using namespace std;
int main()
{
int counter, n, fact = 1;
cout<<"Enter the Number :";
cin>>n;
for (counter = 1; counter <= n; counter++)
{
fact = fact * counter;
}
cout<<n<<" Factorial Value Is :\n"<<fact;
return 0;
}