main()
{
int n;
clrscr();
printf("\n enter the number: ");
scanf("%d",&n);
fact(n);
printf("factorial of %d= %d",n,fact(n));
getch();
}
/* fact(int m)
{
int f=1;
if(m==1)
return(1);
else
{
f=m*fact(m-1);
return(f);
}
} */
fact(int z)
{
return(z==0?1:z*fact(z-1));
}
{
int n;
clrscr();
printf("\n enter the number: ");
scanf("%d",&n);
fact(n);
printf("factorial of %d= %d",n,fact(n));
getch();
}
/* fact(int m)
{
int f=1;
if(m==1)
return(1);
else
{
f=m*fact(m-1);
return(f);
}
} */
fact(int z)
{
return(z==0?1:z*fact(z-1));
}
No comments:
Post a Comment