//A C program to print Fibonacci series till Nth term.
#include <stdio.h>#include <conio.h>
void main()
{
clrscr();
int n,a=0,b=1,c=0,i;
printf("Enter number of terms in Fibonacci series: ");
scanf("%d", &n);
printf("%d\t%d\t",a,b);
for(i = 0; i< n;i++)
{
c = a+b;
printf("%d\t",c);
a=b;
b=c;
}
getch();
}
Output:
0 Comments