#include<stdio.h>
#include<conio.h>
void main()
{
int n;
clrscr();
printf(“enter number: ”);
scanf(“%d”,&n);
if(n<0)
printf(“invalid number”);
else
printf(“%d!=%d”,n,fact(n));
getch();
}
int fact(int x)
{
if(x==0)
return 1;
else
return(x*fact(x-1));
}
Comments
Post a Comment