Search & Find out

Thursday, November 26, 2009

Fibonacci Series

 To find fibonacci series of  'n' numbers



#include "stdio.h"
#include "conio.h"
void main ()
{
    int a,b,c,d,n;
    clrscr ();
    printf("\n Enter a number : \n");
    scanf("%d",&n);
    printf ("Answer = 0 1 ");
    for (d=0,a=0,b=1;d<(n-2);d++)
    {
        c=a+b;
        printf ("%d ",c);
        a=b;
        b=c;
    }
getch ();
}


Download the executable (.exe)  file for this program..
download

0 comments:

Post a Comment

 

My Blog List

Term of Use