Friday, January 02, 2009

Program to find the factorial of anumber

Buzz It
/*Program to find the factorial of anumber*/

#include
#include
void main()
{
int n,r;
clrscr();
printf("Enter anumber ");
scanf("%d",&n);
r=fact(n);
printf("The Factorial is=\t%d" ,r);
getch();
}
fact(int x)
{
int f;
if (x==1)
return (1);
else
f=x*fact(x-1) ;
return(f);
}

0 comments:

Post a Comment