mirror of
https://github.com/boostorg/safe_numerics.git
synced 2026-02-11 12:02:30 +00:00
14 lines
183 B
C++
14 lines
183 B
C++
#include <iostream>
|
|
|
|
constexpr int factorial (int n)
|
|
{
|
|
return n > 0 ? n * factorial( n - 1 ) : 1;
|
|
}
|
|
|
|
int main(){
|
|
int n;
|
|
std::cin >> n;
|
|
factorial( n );
|
|
return 0;
|
|
}
|