Skip to content

Instantly share code, notes, and snippets.

@not-for-me
Last active August 29, 2015 14:06
Show Gist options
  • Save not-for-me/78a76509dff1c2fe00ff to your computer and use it in GitHub Desktop.
Save not-for-me/78a76509dff1c2fe00ff to your computer and use it in GitHub Desktop.
Fibonacci Modified Ver
#include <stdio.h>
int main(void)
{
int t,n,i,f0[41],f1[41];
f0[0]=1;
f0[1]=0;
f1[1]=1;
f1[0]=0;
scanf("%d",&t);
for(i=2; i<=40; i++){
f0[i]=f0[i-1]+f0[i-2];
f1[i]=f1[i-1]+f1[i-2];
}
while(t--){
scanf("%d",&n);
printf("%d %d\n",f0[n],f1[n]);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment