Program in C to print fabbonic series from 1 to 55

Write a program in C to print fabbonic series from 1 to 55

#include <stdio.h>

void main ()
{
          int a,b,c;
          clrscr ();
          a=0;b=1;c=1;
          printf ("%d\n%d",a,b);
          while (c<55)
          {
                   c=a+b;
                   printf ("\n%d",c);
                   a=b;
                   b=c;
          }
          getch ();
}


1 comment: