20 lines
345 B
C++
20 lines
345 B
C++
#include <iostream>
|
|
using std::cout;
|
|
using std::cin;
|
|
using std::endl;
|
|
|
|
template <int x>
|
|
struct Factorial {
|
|
static const unsigned long long value = x * Factorial<x-1>::value;
|
|
};
|
|
|
|
template <>
|
|
struct Factorial<0> {
|
|
static const unsigned long long value = 1;
|
|
};
|
|
|
|
int main() {
|
|
Factorial<20> a;
|
|
cout << a.value << endl;
|
|
return 0;
|
|
} |