You can also receive Free Email Updates:

 

We Offers

  • Basics of C Programming
  • Basics of C Graphics Programming
  • Simple and Effective tutorials
  • No. of Practical Examples
  • Online Support for User's Problems.

Fibonacci Series


                 
                                       fibonacci series means a series which consist N number in which nth number is the sum of n-1 and n-2 th number. For example 0, 1, 1, 2, 3, 5, 8, 13 ...... Now here is the 2 is the sum of 1+1, 3 is the sum of two previous number 1+2, and 5 is the sum of two previous number 2+3 and so on.

C program to print Fibonacci series

#include<stdio.h>

void main()
{
       int n,i,a=0,b=1,c;
       clrscr();
       printf("Enter number of term to print::");
       scanf("%d",&n);
 
       for(i=0;i<n;i++)
       {
              if(i<=1)
                     c=i;      
              else
              {
                     c=a+b;
                     a=b;
                     b=c;
              }
              printf("\n%d",c);
       }
       getch();
}

fibonacci series


0 comments:

Post a Comment