
Infographic of the Day: The future ain’t what it used to be. I don’t see a flying car anywhere on this chart!
Infographic of the Day: The future ain’t what it used to be. I don’t see a flying car anywhere on this chart!
[reddit]
#includestdio.h
#include math.h //please add smaller and larger symbol
unsigned long long fib(int n)
{
double x = sqrt(5)/5;
double f1 = x * pow((1 + sqrt(5)) / 2, n);
double f2 = -x * pow((1 - sqrt(5)) / 2, n);
return (unsigned long long)(f1 + f2);
}
int main()
{
int n;
printf("Find nth Fibonacci number, n = ");
scanf("%d",&n);
printf("%dth Fibonacci number: %llu\n",n,fib(n));
return 0;
}