C – Recursion

C – Recursion 2017-07-20T00:23:37+00:00

Recursion :

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.

C – FACTORIAL NUMBER EXAMPLE PROGRAM :

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

5

Factorial of 5 is 120

Prev Next