#include <stdio.h>
void findFact(int, long int*);
int main()
{
long int fact; //factorial of the number
int num1;
scanf("%d",&num1); //The number is taken from test data
findFact(num1, &fact);
printf("The Factorial of %d is : %ld\n",num1, fact);
return 0;
}
void findFact(int n,long int *fact)
{
*fact=1;
int i;
for(i=1;i<=n;i++)
{
*fact=*fact*i;
}
}
void findFact(int, long int*);
int main()
{
long int fact; //factorial of the number
int num1;
scanf("%d",&num1); //The number is taken from test data
findFact(num1, &fact);
printf("The Factorial of %d is : %ld\n",num1, fact);
return 0;
}
void findFact(int n,long int *fact)
{
*fact=1;
int i;
for(i=1;i<=n;i++)
{
*fact=*fact*i;
}
}
No comments:
Post a Comment