Programmers blog
Programs
Friday, 22 March 2013
C PROGRAM TO FIND FACTORIAL OF N NUMBERS USING RECURSION
#include<stdio.h>
int fact(int n)
{
return n==0?1:n*fact(n-1);
}
void main()
{
int n;
printf("enter n value\n");
scanf("%d",&n);
printf("factorial of %d is %d",n,fact(n));
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment