Skip to content

Instantly share code, notes, and snippets.

@sayantanHack
Created January 18, 2019 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sayantanHack/14cf507c69e8438a42d53199a5a4ffca to your computer and use it in GitHub Desktop.
Save sayantanHack/14cf507c69e8438a42d53199a5a4ffca to your computer and use it in GitHub Desktop.
This is the fibonacci series program , which print the series upto 15 numbers , you can increase or decrease variable n upto how many you choose to print . Happy coding !
#include<stdio.h>
int main(void){
int n=15,i,f1=0,f2=1, nextItem=0; // initializing the variables
for(i=0;i<n;i++){
printf("%d ", f1); // printing variables
nextItem= f1+f2; // fibo algo
f1=f2; // exchanging the values
f2= nextItem;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment