Program to find factorial of no using function.

float factorial(int);
void main()
{
int n;
float f;
printf("Enter a no");
scanf("%d",&n);
f=factorial=%f",f);
getch();
}
float factorial (int x)
{
float f=1;
while(x>0)
{
f=f*x;
x--;
}
return(f);
}

No comments:

Post a Comment