Code:
#include<iostream>
using namespace std;
int main() {
int factorial=1;
int num;
cout << "Enter the number you want the factorial of:\n";
cin >> num;
cout<< endl;
if (num == 0) {
cout << "Factorial = " << 1 << endl;
}
else {
for (int i = 1; i <= num;i++) {
factorial *= i;
}
cout << "Factorial of " << num << " = " << factorial;
}
return 0;
}
Screenshot: