Saturday, May 29, 2010

Fibonacci series

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

void main(void)
{
  int i,j,k,n;
  clrscr();
  i=0;
  j=1;
  printf("%d\n %d\n",i,j);
  for(n=0;n<=5;n++)
  {
    k=i+j;
    i=j;
    j=k;
    printf("%d\n",k);
  }
  getch();
}

Output------>

No comments: