Develop a C++ console application that uses a loop to find the factorial of an accepted integer number.
Here is the Solution to the problem above:
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int n, count;
int factorial=1;
cout<<"Enter an integer: ";
cin>>n;
if ( n< 0)
cout<<"Invalid Value! Please enter a value greater than 0";
else
{
for(count=1;count<=n;++count)
{
factorial*=count;
}
cout<<"Factorial of "<<n<<" is "<<factorial;
cout<<endl;
}
return 0;
}