へんてこのブログ

日々気づいたことや、最近やっていることを書いています

AOJ Volume0-0019

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0019&lang=jp

#include <iostream>
#include <string>
using namespace std;

int hoge (int n,int x,long long int sum) {
    if (n > x) {
        cout << sum << "\n";
        return 0;
    }
    sum *= n;
    hoge(n+1, x, sum);
    return 0;
}

int main (int argc, const char * argv[])
{
    int read;
    while (cin >> read) {
        hoge(1, read, 1);
    }
    return 0;
}