-
-
Save Cih2001/f29e58102d2a7ae8bbc432c462cabae7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
constexpr int factorial (int n) { | |
return (n <= 1) ? 1 : n * factorial(n-1); | |
} | |
int main() { | |
constexpr int f = factorial(4); // f = 24 | |
return 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment