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 - The Fusion of Science and Community**

Dismiss Notice

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!

Loading...

Similar Threads for Number digits | Date |
---|---|

C/++/# Largest number formed by replacing k digits | Aug 9, 2016 |

C/++/# Calculating number Pi digits in C | Nov 11, 2015 |

Problem involving 3 digit numbers | Jan 27, 2014 |

How to work with 100+digit numbers | Jan 27, 2014 |

Calculating digits of Grahams' Number | May 16, 2013 |

**Physics Forums - The Fusion of Science and Community**