- #1
Gagan A
- 20
- 0
I have to code a program in C that will give the correct number of digits of n! where n is upto 500.
I thought this way:
Get the value of log(n!) by using a for loop. (like log1 + log2 + log3... upto logn, log is to the base 10). Now the final answer will be (int)sum + 1. If I give 500! factorial the answer comes out to be 1135 acc. to my program, but the answer given is 1133. Am I right?
I thought this way:
Get the value of log(n!) by using a for loop. (like log1 + log2 + log3... upto logn, log is to the base 10). Now the final answer will be (int)sum + 1. If I give 500! factorial the answer comes out to be 1135 acc. to my program, but the answer given is 1133. Am I right?