Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kjk
Created May 31, 2020 06:59
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 kjk/a11e241abab84cac0e57dc4d70696401 to your computer and use it in GitHub Desktop.
Save kjk/a11e241abab84cac0e57dc4d70696401 to your computer and use it in GitHub Desktop.
#include <iostream>
constexpr long long factorial(int n)
{
long long result = 1;
for (int i = 1; i <= n; ++i) {
result *= i;
}
return result;
}
int main()
{
char test[factorial(3)];
std::cout << factorial(7) << '\n';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment