FACTO SUM problem fails

https://ide.codingblocks.com/#/s/23672
please see whats wrong with this code

https://ide.codingblocks.com/#/s/23722

Here is the corrected version. Basically you can not compute factorial of numbers >10 and store them in integer format. Thus you should take mod 107 while computing factorial itself.

Also there is no need of writing cout statements if question doesn’t ask for them.

1 Like