#include<stdio.h>
#include<conio.h>
void main()
{
int a,f;
int fact(int);
clrscr();
printf(“enter a no: ”);
scanf(“%d”,&a);
f=fact(a);
printf(“factorial= %d”,f);
getch();
}
int fact(int x)
{
int fac=1,i;
for(i=x;i>=1;i--)
fac=fac*i;
return(fac);
}
Programming snippets. C , C++ , C# , Java , PHP , Blogging Tips, Self Help, Wellness,Marketing, Social Media tools
Comments
Post a Comment