void fact(int n)
{
int f=1;
for(;n>0;n--)
f=f*n;
printf(" factorial value: %d ",f);
}
void main()
{
int n,f;
clrscr();
printf(" enter any no: \n");
scanf("%d",&n);
fact(n);
getch();
}
output:
enter any no: 5
factorial value: 120
void fact(int n)
{
int f=1;
for(;n>0;n--)
f=f*n;
printf(" factorial value: %d ",f);
}
void main()
{
int n,f;
clrscr();
printf(" enter any no: \n");
scanf("%d",&n);
fact(n);
getch();
}
output:
enter any no: 5
factorial value: 120
0 Comments
Post a Comment