Q. Write a function fact to calculate the factorial value of any number.
monospace; font-size: large;">
int fact(int n)
{
int z=1;
for(; n>=1; n--)
z = z * n;
return(z);
}
The output of above program would be:
int fact(int n)
{
int z=1;
for(; n>=1; n--)
z = z * n;
return(z);
}
The output of above program would be:
![]() |
Figure: Screenshot for find factorial value using user define function C program |
0 comments:
Post a Comment