Check out example codes for "fcatorianls c++". It will help you in understanding the concepts better.

Code Example 1

#include <iostream> 

//n! = n(n-1)!
int factorial (int n)
{
  if (n ==0)
  {
    return 1; 
  }
  else 
  {
	return n * factorial(n-1); 
  }
}

Learn ReactJs, React Native from akashmittal.com