Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
factorial.cpp File Reference

C++ program to find factorial of given number. More...

#include <iostream>
Include dependency graph for factorial.cpp:

Functions

unsigned int factorial (unsigned int n)
 
int main ()
 

Detailed Description

C++ program to find factorial of given number.

Function Documentation

◆ factorial()

unsigned int factorial ( unsigned int  n)

function to find factorial of given number

8 {
9 if (n == 0)
10 return 1;
11 return n * factorial(n - 1);
12}
unsigned int factorial(unsigned int n)
Definition: factorial.cpp:8
Here is the call graph for this function:

◆ main()

int main ( void  )

Main function

15 {
16 int num = 5;
17 std::cout << "Factorial of " << num << " is " << factorial(num)
18 << std::endl;
19 return 0;
20}
T endl(T... args)
Here is the call graph for this function: