Saturday, 24 October 2015

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 terms\n");
   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("%d\n",next);
   }
 
   return 0;
}

Output:


No comments:

Post a Comment

How to improve applications performance which is hosted in cloud ?

Improving the performance of an application hosted in Microsoft Azure involves a combination of optimizing your application code, leveraging...