C++ Programming Tutorial

 
 
 
 

Image

 # include <iostream.h>
 # include    <conio.h>

 long Table[25]={0};

 const long fibonacci(const int);

 int main()
 {
    clrscr( );

    int number;

    cout<<\"\\n Enter the number ( 1 - 25 ) = \";
    cin>>number;

    number=((number>25)?25:number);

    cout<<\"\\n\\n The \"<<number<<\"_th term of fibonacci series = \"<<fibonacci(number);

    getch( );
    return 0;
 }


 //----------------------------  fibonacci( )  ---------------------------//


 const long fibonacci(const int n)
 {
    if(Table[n]==0)
    {
       if(n<=1)
      Table[n]=n;

       else
      Table[n]=(fibonacci(n-1)+fibonacci(n-2));
    }

    return Table[n];
 }

    Related Post:
  1. Double Linked List-C++

  2. Program to illustrate the implementation of Double Ended linked list as a Queue

  3. Program that provides an example of friend function of a class

  4. Program to draw a Circular Arc using Trigonometric Method

  5. Program to draw an Ellipsoid using Parametric Equations

  6. Program to show the implementation of Window-to-Viewport Transformaton

  7. Program to add, subtract and multiply matrix

  8. Program of circular doubly link list with insert, append, delete, copy, reverse and display operations

  9. Program to illustrate the implementation of Y-Direction Shear Transformation

  10. Program to illustrate object initialization and assignment by default member wise copy

  11. Program to illustrate the implementation of arrays as a Stack

  12. Program to implement the Kurskals Algorithm to solve Minimum Cost Spanning Tree Problem (MST) using Graphics with Mouse Support

  13. Program of heap sort

  14. Code for finding a no in a binary search tree and displaying its level where it is found (root is at zero level)

  15. Program to illustrate the difference among public, protected and private inheritance

  16. Program to computes the n_th term of the fibonacci series using Toplogical Odering and Dynamic Programming Technique

  17. Program of Bresenham line drawing algorithm

  18. Program to estimate the Integral value of the function at the given points from the given data using Simpsons 1/3 Rule

  19. Program to sort that set of strings in ascending and descending order of their weights. The sorted output is to be displayed on the screen

  20. Program to show the Urdu Alphabets using Matrix Method