C – Recursion

C – Recursion 2017-06-12T12:02:44+00:00


Recursive functions are those functions, which call itself within that function. A recursive function must have the following type of statements.

  • A statement to test and determine whether the function is calling itself again.
  • A statement that calls the function itself and must be argument.
  • A conditional statement (if-else)
  • A return statement.

Example: Factorial of a number

This is the most famous program on recursion. Many versions of this program are available. All programs differ only in checking conditions. I prefer to write like the following one.

Output :

Enter a number


Factorial of 5 is 120

Prev Next