C program to calculate factorial of number

# C program to calculate factorial of number

5954
7
SHARE

C program to calculate factorial of number using recursion which accepts the number from the user as input of which Factorial has be calculated and return the output obtained by calculation factorial of a number. Lets us how to code of a number n.

### C Program to calculate Factorial of Number N :

```# include <stdio.h>
# include <conio.h>
# include <math.h>
float getex(double);
main()
{
int i,n;
double s=0.0,a,b;
clrscr();
printf("*** Factorial Calculator *** \n.:: C Code Champ \n--------------------------------\n");
printf("Please enter N to Calculate N! :");
scanf("%d",&n);
if (n>=0)
{
// calculating s = Siq (i=1 to n) [ Log i ]
for (i=1;i<=n;i++)
s+=log10(i);
b = floor(s);
// End of Calculating S
a = getex(s-b);
printf("\n\n\n   Result: %d!  ~=  %5.4f e+%d\n\n-----------\n",n,a,(int)(b));
printf("[[[   Please enter any key to exit ...   ]]]");
}

else
{
clrscr();
printf("Invalid argument found ,\n [[[   please enter any key to exit ... ]]]");
}
getch();

}
float getex(double p)
{
float r;
r = pow(10,p);
return r;
}```

I hope you all have enjoyed the . If you face any issues with code just write your queries in comments below.

1. You actually make it seem so easy with your presentation but I find this topic to be actually something which I think I would never understand. It seems too complicated and very broad for me. I am looking forward for your next post, I will try to get the hang of it!

2. Woman of Alien…

Ideal get the job done you’ve got done, this great site is de facto neat with excellent info. Time is God’s means of trying to keep every little thing from happening simultaneously….

3. I like the valuable information you provide in your articles.
I’ll bookmark your weblog and check again here frequently.

I am quite certain I will learn plenty of new stuff right here!
Good luck for the next!

4. A vacuum-cleaner is the most effective of cleansing tools; it can also be the more expensive.
There are several different kinds of vacuum with many different characteristics.
So before purchasing a premier hoover ensure you understand which kind of vacuum-cleaner