PROGRAM
#include<stdio.h>
void findFact(int,long int *);
int main()
{
long int fact;
int num1;
printf("Enter a number:");
scanf("%d",&num1);
findFact(num1,&fact);
printf("The factorial of %d is: %d\n",num1,fact);
return 0;
}
void findFact(int n,long int *f)
{
int i;
*f=1;
for(i=1;i<=n;i++)
{
*f=*f*i;
}
}
Thank you...
ReplyDelete