Tuesday, April 10, 2012

C Program for generate Fibonacci


/*******<soeasyprograms.blogspot.in>*****/
//C Program for generate Fibonacci series
#include "stdio.h"
#include "conio.h"
void main()
{
 int a,b,c,i,n;
 clrscr();
 a=0;
 b=1;
 printf("\n enter n for how many times 


generate series");
 scanf("%d",&n);
 printf("\n FIBONACCI SERIES\n");
 printf("\t%d\t%d",a,b);
for(i=0;i<n;i++)
{
     c=a+b;
     a=b;
     b=c;
     printf("\t%d",c);
 }
 getch();
}

Output of this Program is:




No comments:

Post a Comment