I have to code a program in C that will give the correct number of digits of n! where n is upto 500.(adsbygoogle = window.adsbygoogle || []).push({});

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?

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Number of digits in n!

**Physics Forums | Science Articles, Homework Help, Discussion**