C program to find factorial of a number using recursive function
Today i am going to cover a simple program to find factorial of a number using recursion.To move further with program let quickly understand the factorial.
Recursion - If a method call itself than this is recursion.
In above where recursion method is calling to itself,so there is a recursion.Here is the program to find factorial of a number using recursion.
Output:
Above program will take the input from user and calculate the factorial of it using recursion.
To calculate factorial of a number using without recursion use below link -
http://www.codibucket.com/2016/08/c-program-to-find-factorial-of-number.html
Hope you like this post.Please provide your feedback.
Recursion - If a method call itself than this is recursion.
In above where recursion method is calling to itself,so there is a recursion.Here is the program to find factorial of a number using recursion.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include <stdio.h> void main() { int n, i; long fact=1; printf( " Enter any number: " ); scanf( "%d" , &n); for (i=1; i<=n; i++) fact = fact*i; printf( " Factorial of number is = %d" , fact); getch(); } |
Output:
1Enter any number
5
Factorial of number is 120
Above program will take the input from user and calculate the factorial of it using recursion.
To calculate factorial of a number using without recursion use below link -
http://www.codibucket.com/2016/08/c-program-to-find-factorial-of-number.html
Hope you like this post.Please provide your feedback.
C program to find factorial of a number using recursive function
Reviewed by CodiBucket
on
02:49
Rating:

No comments: