Write a program using recursion to find factorial of a number.
Team Answered question April 13, 2024
#include<stdio.h> #include<conio.h> int fact(int); int main() { int x,n; clrscr(); printf(" Enter the Number to Find Factorial :"); scanf("%d",&n); x=fact(n); printf(" Factorial of %d is %d",n,x); return 0; getch(); } int fact(int n) { if(n==0) return(1); return(n*fact(n-1)); }
Team Answered question April 13, 2024