Asked in C Programming
C Programming

Write a example of recursion?

Answer

Wiki User
07/18/2009

Following function calculates factorial of a number using recursion. unsigned int factorial(unsigned int a)

{

if (a == 1)

return 1;

else

{

a *= factorial(a-1);

return a;

}

} recursion n. see recursion.