- Home
- C Examples
- Factorial Of Number Using Recursion
C - Factorial Of Number Using Recursion
विवरण :
कोई विवरण नहीं है |
सोर्स कोड :
#include <stdio.h> #include <conio.h> void main(){ int a,fact; printf("Enter the number : "); scanf("%d",&a); fact=factorial(a); printf("Factorial of %d is %d",a,fact); getch (); } int factorial (int x) { int f; if(x==1){ return (1); } else{ f=x*factorial(x-1); } return(f); }
आउटपुट :
Enter the number : 5 (you entered : 5) Factorial of 5 is 120