VS Code
#include<stdio.h>
int factorial(int n)
{
if(n!=0)
return n*factorial(n-1);
else
return 1;
}
int main()
{
int num, a;
printf(" Enter the Number to Find Factorial : ");
scanf("%d",&num);
a = factorial(num);
printf("Factorial of %d is = %d\n",num,a);
return 0;
}
Turbo C++
0 Comments