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

{
if (n == 0)
return 1;
return n * factorial(n - 1);
}
factorial
unsigned int factorial(unsigned int n)
Definition: factorial.cpp:8

## main()

int main | ( | void |  | ) |

Main function

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