Monday, 24 August 2015

Step by Step Fibonacci series coding for beginners

/* Fabonnaci series*/
#include<stdio.h>
#include<conio.h>
int main()
{
/*declaration of variables*/
      int a,b,c;
/*valuation of empty variables*/
      a=0;
      b=1;
      c=0;
      printf("%d\n%d\n",a,b);
/*setting limit for the series to stop*/
      while(b<10000)
/*start of while loop as relating to the given cretaria*/
      {
                    c=a+b;
                    a=b;
                    b=c;
/*getting output*/
                    printf("%d\n",c);
                    }
/*holding the result*/
                    getch();
                    }

No comments:

Post a Comment