Skip to content

Instantly share code, notes, and snippets.

@adamlukes
Created September 19, 2017 09:11
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 adamlukes/6252c2a257c79ea5fe91b8e73762ba9c to your computer and use it in GitHub Desktop.
Save adamlukes/6252c2a257c79ea5fe91b8e73762ba9c to your computer and use it in GitHub Desktop.
C Program to Display Fibonacci Sequence
#include <stdio.h>
int main()
{
int i, n, t1 = 0, t2 = 1, nextTerm;
printf("Enter the number of terms: ");
scanf("%d", &n);
printf("Fibonacci Series: ");
for (i = 1; i <= n; ++i)
{
printf("%d, ", t1);
nextTerm = t1 + t2;
t1 = t2;
t2 = nextTerm;
}
return 0;
}
@adamlukes
Copy link
Author

adamlukes commented Sep 19, 2017

To follow this code tutorial,please have a basic overview of C Programming language and Top 10 Alarm clock Apps for Android.
Output of this Program will be as under:
Enter the number of terms: 10
Fibonacci Series: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment