Program to Generate Fibonacci Series Using While

#include<stdio.h>
#include<conio.h>
void main()
{
  clrscr();
  int a=0,b=1,i=0,c=0,term;
   printf("\n enter number a:");
   scanf("\n %d",&term);
   while(i<=term)
   {
   printf("\n %d",c);

   c=a+b;
   b=a;
   a=c;
   i++;
   }
     getch();
   }

Leave a Reply