Write a C++ program to find the factorial of a given number Test Case 1 Input (stdin) 4 Expected Output The factorial is 24 Test Case 2 Input (stdin) 5 Expected Output The factorial is 120
#include <iostream>
using namespace std;
int main()
{
unsigned int n;
unsigned long long factorial = 1;
cin >> n;
for(int i = 1; i <=n; ++i)
{
factorial *= i;
}
cout << "The factorial is "<< factorial;
return 0;
}