#include <iostream>
template<longlongi>longlongfibonacci(){returnfibonacci<i-1>()+fibonacci<i-2>();}template<>longlongfibonacci<1>(){return1;}template<>longlongfibonacci<2>(){return1;}intmain(){std::cout<<"Fibonacci of 27 is "<<fibonacci<27>()<<std::endl;return0;}
C++ can, of course, do it at build time with a bit of templates.
Here, we're definitely recursing - twice, because it's simpler. At runtime, it's just printing the value out that's been calculated by the compiler during the build.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
C++ can, of course, do it at build time with a bit of templates.
Here, we're definitely recursing - twice, because it's simpler. At runtime, it's just printing the value out that's been calculated by the compiler during the build.