Saturday, October 26, 2013

Fibonacci Series

FIBONACCI SERIES

Program:

#include<stdio.h>
#include<conio.h>
void main()
{
int f,s,n,c,t;
clrscr();
printf(“\nEnter the number of series :”);
scanf(“%d”,&n);
f=1;
s=1;
printf(“%d\t”,f);
printf(“%d\t”,s);
for(c=1;c<=n-2;c++)
{
t=f+s;
printf(“%d\t”,t);
f=s;
s=t;
}
getch();
}

Output:
Enter the number of series:8

1 1 2 3 5 8 13 21 



No comments: