C++ Programming Tutorial

 
 
 
 

Image

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

 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(n<=1)
       return n;

    else
       return (fibonacci(n-1)+fibonacci(n-2));
 }

    Related Post:
  1. Program to represent or compress \‘2ABCDE to string \‘AABCDE\’

  2. Program to search an element in an array using Linear search

  3. Program to show the use of Bitwise Operator Right Shift ( &gt;&gt; )

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

  5. Program that prints odd numbers, even numbers and the numbers that are divisible by 5 b/w 0 to 50

  6. Program to check whether a word is palindrome or not (using classes & pointers )

  7. Write a program to Add Two Matrix

  8. Program for Fahrenheit to Celcius

  9. Program that provides an example to return an object from a function

  10. Program to computes the n_th term of the fibonacci series using Dynamic Programming Technique

  11. Program that provides an example of passing structure as parameter using call by reference

  12. Program of maintaining banking account information system using inheritance

  13. Program of addition and subtraction of large numbers

  14. Program to estimate the Integral value of the function at the given points from the given data using Romberg Method

  15. Program of time conversion using conversion functions

  16. Program to illustrate the use of the break statement

  17. Program to create a stack using dynamic memory allocation

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

  19. Program to illustrate the use of pointer this using header file this.h

  20. Program to illustrate use of arrays as data items in classes