Thursday, February 2, 2012

FIBONACCI SERIES


#include<stdio.h>
#include<conio.h>

void main()
{
  int i=0,j=1,k=2,r,f;
  clrscr();
  printf("Enter the number range:");
  scanf("%d",&r);
  printf("\nFIBONACCI SERIES: ");
  printf("%d %d",i,j);
  while(k<r)
  {
            f=i+j;
            i=j;
            j=f;
            printf(" %d",j);
            k++;
  }
  getch();
}

No comments:

Post a Comment