Skip to content

Instantly share code, notes, and snippets.

@jatinsharrma
Last active March 27, 2019 13:48
Show Gist options
  • Save jatinsharrma/e38f5b600f3f31333eb7d21876bf05b8 to your computer and use it in GitHub Desktop.
Save jatinsharrma/e38f5b600f3f31333eb7d21876bf05b8 to your computer and use it in GitHub Desktop.
Fibonacci Series
#include <stdio.h>
int fibnocci(int x){
int fib[x];
fib[0] = 0;
fib[1] = 1;
if (x>=2){
int temp = 2;
while (temp != x){
fib[temp] = fib[temp-2] + fib[temp-1];
temp++;
}
for(int i =0; i<x; i++){
printf("%d\n",fib[i]);
}
}
}
void main() {
fibnocci(11);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment