WAP to Find Factorial of a Number using Recursion.
#include<stdio.h> #include<math.h> int main() { int a,b; printf("Enter the number = "); scanf("%d",&a); b=factorial(a); printf("facatorial of %d is %d ",a,b); } int factorial(int a) { if(a==1 || a==0) { return 1; } else return a*factorial(a-1); }
WAP to Find Factorial of a Number using Recursion.
Reviewed by Unknown
on
03:39
Rating:
No comments: