netoops blog

Saturday, 24 August 2013

Fibonacci Series

#include <stdio.h>
#include <conio.h>
#include <process.h>

void main()
{
   int var1,var2,i,var3=0,var4=1;
   clrscr();
   printf("No of terms to display\t");
   scanf("%d",&var1);
   if(var1==1)
   {
      printf("%d",var4);
      getch();
      exit(0);
   }
   else
      printf("%d\n",var4);

   for( i=1;i<=(var1-1);i++)
   {
    var2=var3;
    var3=var4;
    var4=var2+var3;
    printf("%d\n",var4);
  }
  getch();
}

Tech Knowledege
SOCIALIZE IT →
FOLLOW US →
SHARE IT →

0 comments :

Post a Comment

 
Subscribe For Free Updates!

We'll not spam mate! We promise.

Become Our Fan on Social Sites!