팩토리얼 (Factorial)
Source Code
cpp
#include <iostream>
using namespace std;
int factorial(unsigned int n)
{
if (n == 0)
return 1;
else
return n*factorial(n-1);
}
int main()
{
int N;
cout << "\n\n"
<< "N=? \n>>";
//scanf("%d",&N);
cin >> N;
cout << "\n"
<< N << "! = " << factorial(N) << endl;
return 0;
}