C++ Programming Tutorial

 
 
 
 

Image

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

  const long factorial(const long);


 int main( )
 {
    clrscr( );

    int n;

    cout<<\"\\n Enter the number = \";
    cin>>n;

    cout<<\"\\n n! = \"<<n<<\"!\"<<\"  =  \"<<factorial(n)<<endl;

    getch( );
    return 0;
 }



 //--------------------------  factorial( )  -----------------------------//


 const long factorial(const long n)
 {
    long fn=1;

    if(n>1)
       fn=(n*factorial(n-1));

    return fn;
 }

    Related Post:
  1. Comment line in c

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

  3. 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..

  4. Program to implement the Kurskals Algorithm to solve Minimum Cost Spanning Tree Problem (MST) using Graphics

  5. Program to solve the mystery of Towers of Hanoi using recursion

  6. FUNCTION WITH ALIAS NAME OR REFERENCE VARIABLE IN C++

  7. Program to draw a line using Bresenhams Line Algorithm (BLA) for lines with slopes positive and greater than 1

  8. Program of simple Constructions

  9. Program to draw a Circular Arc using Trigonometric Method

  10. 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

  11. Program that computes and display the square of first ten integers. (using for loop)

  12. Program of Deapth First Search Traversal ( DFS )

  13. Program to read a Linear System of Equations,then evaluate it by using Gauss-Elimination Method and show the result

  14. Program to illustrate constant objects and constant member functions

  15. Program to draw a line using Parametric equations

  16. Program to illustrate the declaration , initialization and printing a constant variable

  17. Program of inheritance using shape class and area calculation

  18. Program to illustrate an example of Inheritance

  19. Program to perform sorting of linklist

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