Last active
March 16, 2018 07:26
-
-
Save xprilion/5396c5747f698fee7b903f30250e8edb to your computer and use it in GitHub Desktop.
Fibonacci Series using PHI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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