Skip to content

Instantly share code, notes, and snippets.

@Cih2001
Created July 3, 2020 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cih2001/f29e58102d2a7ae8bbc432c462cabae7 to your computer and use it in GitHub Desktop.
Save Cih2001/f29e58102d2a7ae8bbc432c462cabae7 to your computer and use it in GitHub Desktop.
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