Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // C++11 constexpr functions use recursion rather than iteration
- // (C++14 constexpr functions may use local variables and loops)
- constexpr int factorial(int n)
- {
- return n <= 1 ? 1 : (n * factorial(n - 1));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement