Friday 31 August 2012

FIBONACCI SERIES IN C

#include<stdio.h>
#include<conio.h>
main()
{
int n,i,c,a=0,b=1;
printf("Enter Fibonacci series of nth term : ");
scanf("%d",&n);
printf("%d %d ",a,b);
for(i=0;i<=(n-3);i++)
{
c=a+b;
a=b;
b=c;
printf("%d ",c);
}
getch();
}

No comments:

Post a Comment