Jan 12, 2016

C Program code to find Fibonacci series


Algorithm:-

1.Start
2.Let i=0,j=1,temp=0,s=0
3.Accept the limit 'a'
4.while (i<a)
   print s
   temp=s
   s=s+j
   j=temp
5.Increment i by 1,goto step 4
6.Stop

Program:-

/*Program to find Fibonacci series - Crazy Factzz */
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a,i=0,j=1,s=0,temp=0;
printf("\n Enter the limit : ");
scanf("%d",&a);
printf("\n Fibonacci Series \n  ");
while (i<a)
{
printf("%3d ",s);
temp=s;
s=s+j;
j=temp;
i++;
}
getch();
}

For more C programs - click here