Friday, November 23, 2012

WRITE A C PROGRAM TO GENERATE 3 DIGITS FIBONACCI SERIES


/*  WRITE A C PROGRAM TO GENERATE 3 DIGITS FIBONACCI SERIES */

#include<stdio.h>
#include<conio.h>
void main()
{
            int a=0,b=1,c;
            clrscr();
            printf("THREE DIGITS FIBONACCI SERIES :\n");
            for(c=a+b;c<100;c=a+b,a=b,b=c);
            for(;c<1000;c=a+b,a=b,b=c)
                        printf("\n%d",c);
            getch();
}

/*
            =====OUT PUT=====       

            THREE DIGITS FIBONACCI SERIES :

            144
            233
            377
            610
            987

*/

0 comments:

Post a Comment