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 to sort that set of strings in ascending and descending order of their weights. The sorted output is to be displayed on the screen

  2. Program to perform insertion sort

  3. Program that reads a number and displays it with its digits in reverse order using do-while loop

  4. Program that take font and background color and text input from a user and display it in center aligned

  5. Library system using pointers

  6. Program of calculator

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

  8. Program to solve the Towers of Hanoi Problem (using Recursive Algorithm)

  9. Program that reads a number ,coumputes and displays its factorial ( using for loop )

  10. Program to count number of words, lines and characters in given string

  11. Program that changes an infix expression to a postfix expression according

  12. Program to illustrate pointers , structure and passing structure pointers to function.

  13. Program to display string triangle

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

  15. Program to estimate the value of Fourth Derivative of the function at the given points from the given data using Central Difference Formula of order 4

  16. Program to illustrate the implementation of arrays as a Linear Queue

  17. Program to fill different types of geometric shapes using Flood Fill Algorithm (Using Linked-List)

  18. Program to get possible prime numbers like number 6158 contains the substrings 6, 1, 5, 8, 61, 15, 58, 615, 158, and 6158.Find the largest substring..

  19. Program of scaling about origin

  20. PROGRAM OF OPERATOR PRECEDENCE MATRIX