Thursday, 17 September 2015

C PROGRAMMING-- FIBONACCI SERIES

#include <stdio.h>
#include <conio.h>
void main()
{
    clrscr();
    int n,i,a=0,b=1,output;
    printf("enter the no of terms=");
    scanf("%d",&n);
    printf("%d\t%d",a,b);

    for(i=2;i<n;i++)
    {    output=a+b;
        printf("\t%d",output);
        a=b;
        b=output;
     }
     getch();
}


No comments:

Post a Comment