PROGRAM:
#include<stdio.h>
int factorial(int n)
{
if(n==0 || n==1) return 1;
else
return n*factorial(n-1);
}
main()
{
int n;
printf("\nEnter
a Number\n"); scanf("%d",&n);
printf("\nThe
factorial of %d is %d\n",n,factorial(n)
}
OUTPUT:
Enter
a Number 6
The factorial of 6 is 720
No comments:
Post a Comment