Skip to content

Instantly share code, notes, and snippets.

@xprilion
Last active March 16, 2018 07:26
Show Gist options
  • Save xprilion/5396c5747f698fee7b903f30250e8edb to your computer and use it in GitHub Desktop.
Save xprilion/5396c5747f698fee7b903f30250e8edb to your computer and use it in GitHub Desktop.
Fibonacci Series using PHI
#include<stdio.h>
int main(){
int num, n;
float phi = 1.618;
scanf("%d", &n);
int i;
num=1;
printf("0 1 ");
for(i=0;i<n-1;i++){
num = (int) (phi*num);
if(i&1)
num++;
printf("%d ", num);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment