Friday, July 22, 2016

Fibonacci Series in C Programming

/* Program in C to print fibonacci series upto 10th term */
#include<stdio.h>
#include<conio.h>
void main()
{
  int a=2,b=2,c,i;
  printf(" %d ",a);
  printf(" %d ",b);
  for(i=1;i<=10;i++)
  {
      c=a+b;
     printf("%d ",c);
     a=b;
     b=c;
  }
  getch();
}

0 comments:

Post a Comment