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 maintains library shop stock using link list

  2. Program to create a stack using dynamic memory allocation

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

  4. Program of Deterministic Finite Automation (DFA) for identifier, real number with optional Integer and Fractional Part

  5. Program to read a Non Linear Function, construct and display the Difference Table

  6. Program of addition and subtraction of large numbers

  7. Program that prints all the even numbers b/w 0 to 50 ( using while, do-while and for loop )

  8. Program to generate a triangular wave form according to a specified pair of Amplitude and Frequency

  9. Program to illustrate the implementation of Double Ended linked list as a Stack

  10. Program to draw a Chess Board

  11. Program that provides an example of scope resolution operator

  12. Program to draw different kinds of Thick Lines

  13. Program to draw a Rectangle

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

  15. Program to show the Urdu Alphabets using Stroke Method

  16. Program to estimate the Integral value of the function at the given points from the given data using Trapezoidal Rule

  17. Program to illustrate the use of nested structures

  18. Program to illustrate the binary operator(-) overloading by creating an object of that class

  19. Program of Flood fill algorithm

  20. Program to construct Newtons Backward Difference Interpolation Formula from the given distinct equally spaced data points