About Me

My photo
Raipur, Chhattisgarh, India
Hi , I am Amit Thakur. I have worked as a QA Engineer for two years and as a Java Developer for one year in NIHILENT TECHNOLOGIES PVT. LTD., Pune.Currently I am working as DEAN (Research & Development) in Bhilai Institute of Technology, Raipur.

Monday, September 2, 2013

Find Factorial of Number Using Recursion

#include<stdio.h>
#include<conio.h>
int fact(int);
void main()
{
 int x,n;
 printf("nEnter the value of n :");
 scanf("%d",&n);
 x=fact(n);
 printf("n%d",x);
 getch();
}
int fact(int n)
{
 if(n==0)
  return(1);
 return(n*fact(n-1));
}

No comments: