Monday, 23 February 2015

Factorial Program in C


#include<stdio.h>
#include<conio.h>
main()
{
int n;
clrscr();
printf("\n Enter Number To Find Factorial\n");
scanf("%d",&n);
printf("\n Factorial Of Given Number is :%d",fact(n));
getch();
}
int fact(int n)
{
int fa;
if(n==0)
return 1;
else
fa=n*fact(n-1);
return fa;
}

No comments:

Post a Comment