Tech News

Fibonacci series

Before start the programming you need to know exactly what is the Fibonacci series, why it comes around the world??

Golden mean:

Program:
/* Fibonacci Series c language */
#include<stdio.h>
 
int main()
{
   int n, first = 0, second = 1, next, i;
 
   printf("Enter the number of termsn");
   scanf("%d",&n);
 
   printf("First %d terms of Fibonacci series are :-n",n);
 
   for ( i = 0 ; i < n ; i++ )
   {
      if ( i <= 1 )
         next = i;
      else
      {
         next = first + second;
         first = second;
         second = next;
      }
      printf("%dn",next);
   }
 
   return 0;
}

Output:


Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x