Write a C Program To calculate factorial of an integer number. (try taking big number also).
#include <stdio.h>
unsigned long long int factorial(unsigned long long int n)
{
if (n == 0)
return 1;
return n * factorial(n - 1);
}
int main()
{
unsigned long long int fact,num;
printf("ENTER A NUMBER : ");
scanf("%lu",&num) ;
fact=factorial(num);
printf("Factorial of %lu is %lu", num, fact);
return 0;
}
Post a Comment
0 Comments