/*C PROGRAM FOR FIBONNACI SERIES */
#include<stdio.h>
#include<conio.h>
void main()
{
int i,a=0,b=1,t=0,n;
clrscr();
printf("\n\t\tFIBONNACI SERIES");
printf("\n\t\t~~~~~~~~~~~~~~~~");
printf("\nEnter the number of terms:");
scanf("%d",&n);
printf("%d\t%d",a,b);
for(i=2;i<n;i++)
{
t=a+b;
printf("\t%d",t);
a=b;
b=t;
}
getch();
}
OUTPUT:
FIBONNACI SERIES
~~~~~~~~~~~~~~~~
Enter the number of terms:8
0 1 1 2 3 5 8 13
No comments:
Post a Comment