#include <stdio.h>
int main()
{
int i, n, t1 = 0, t2 = 1, nextTerm;
printf("-:FIBONACCI SERIES:- \n\n");
printf("ENTER THE NUMBER OF TERMS: ");
scanf("%d", &n);
printf("\n\n\n Fibonacci Series: ");
for (i = 1; i <= n; i++)
{
printf("%d ", t1);
nextTerm = t1 + t2;
t1 = t2;
t2 = nextTerm;
}
printf("\n");
return 0;
}
Execution
For students : you can download and use Dev c++ compiler for executing this program.