Skip to content

Instantly share code, notes, and snippets.

@Fiona-J-W
Created January 4, 2014 22:04
Show Gist options
  • Save Fiona-J-W/8261357 to your computer and use it in GitHub Desktop.
Save Fiona-J-W/8261357 to your computer and use it in GitHub Desktop.
#include <iostream>
constexpr unsigned long long fib(unsigned n) {
return n <= 1 ? 1 : fib(n-1) + fib(n-2);
}
int main() {
auto fib50 = fib(50);
std::cout << fib50 << std::endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment