Skip to content

Instantly share code, notes, and snippets.

@vikhyat
Created December 10, 2014 05:08
Show Gist options
  • Save vikhyat/e5525c31c9b66d88cbd4 to your computer and use it in GitHub Desktop.
Save vikhyat/e5525c31c9b66d88cbd4 to your computer and use it in GitHub Desktop.
int fib(n) {
return n < 2 ? n : fib(n-1) + fib(n-2);
}
int main() {
int t, n;
scanf("%d\n", &t);
while (t--) {
scanf("%d\n", &n);
printf("%f\n", fib(n+2) / pow(2, n));
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment