Print Fibonacci Series in C

Advertisements

Prev Tutorial Next Tutorial

Fibonacci Series Program in C

Fibonacci series is in the form of 0, 1, 1, 2, 3, 5, 8, 13, 21,...... To find Fibonacci series you need to add two previous terms/digits and get next term/number.

print fibonacci series

Print fibonacci series

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

 void main()
  {
   int i,no, first=0, second=1, next;
   clrscr();
   first=0;
   second=1;
   printf("Enter nubmer of terms for Series: ");
   scanf("%d",&no);
   printf("Fibonacci series are:\n");
   for(i=0; i<no; i++)
    {
    printf("%d\n",first);
    next = first + second;
    first = second;
    second = next;
   }
   getch();
}

Output

Enter nubmer of terms for Series: 7
Fibonacci series are:
0
1
1
2
3
5
8

Fabonic Series upto 100

program fibonacci series upto 100

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

void main() 
{ 
double i, first, second, next; 
clrscr(); 
first=0; 
second=1; 
for(i=1; i<=100; i++) 
{ 
 printf(" %lf",first); 
 next=first+second;
 first=second;
 second=next; 
} 
getch(); 
} 

Output

print fibonacci series upto 100
Prev Tutorial Next Tutorial

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements