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. Program that performs binary search

  2. Program to illustrate the 2D array of int using pointers

  3. Program to estimate value of First Derivative of the function at the given points from the given data using Backward Difference Formula , Forward diff

  4. Program of inline function

  5. Shortest Path using kruskal algorithm

  6. Program to draw a Cubic Bezier Curve

  7. Program that performs addition operation of 2 polar objects by + operator overloading.

  8. Program of virtual inheritance that takes input of staff members and performs an operation on it

  9. Program to help Umar in this task. Represent each city by one lowercase character. Thus, you can have at most 26 different cities to visit....

  10. Write a function power() to raise a number m to a power n

  11. Program to illustrate static member functions

  12. Program to print a Single Ended Linked List in Original & Reverse order and sort it in Ascending & Decending Order

  13. Matrix Addition Program

  14. Program to coumputes and displays the factorial of the given number ( using Recursive Algorithm )

  15. Program to rotate the word Computer by 1 results in rCompute

  16. Program to estimate the value of Third Derivative of the function at the given points from the given data using Central Difference Formula of Order 4

  17. Program that provides an example of class, object and constructors

  18. Program to illustrate an example of Inheritance

  19. Program to read a Non-Linear equation in one variable, then evaluate it using Newton-Raphson Method and display its kD accurate root

  20. Program of LL parser1