SETHA SITE INFORMATION

  • Increase font size
  • Default font size
  • Decrease font size

Calculate Factoriel in Turbo C++

E-mail Print PDF
Code below is the C++ programming language uses to calculate factorial of value n using recursive function (return n*fact(n-1).
n! = 1 x 2 x 3 x 4 x ... x n
long fact(int n)
{
	if(n==0) return 1;
	else return n*fact(n-1);
}