【清华大学考研机试题】n的阶乘

版权声明:假装有个原创声明……虽然少许博文不属于完全原创,但也是自己辛辛苦苦总结的,转载请注明出处,感谢! https://blog.csdn.net/m0_37454852/article/details/88360319

原题链接

#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main()
{
    int N;
    while(scanf("%d", &N) != EOF)
    {
        long long int R = 1;
        for(int i=2; i<=N; R*=i, i++);
        printf("%lld\n", R);
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/m0_37454852/article/details/88360319