To find the sum of digits of the number which is the result of 100! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

To find the sum of digits of the number which is the result of 100!

100!=number Result=sum of the digits of the number E.g 4!=24 Result=2+4=6 Output=6 https://www.sololearn.com/discuss/2090630/?ref=app

7th Dec 2019, 3:56 PM
Subhankar
Subhankar - avatar
11 Answers
11th Dec 2019, 1:26 PM
A͢J
A͢J - avatar
+ 3
Subhankar We can do by using BigInteger. Check my code again and enter 100.
11th Dec 2019, 2:48 PM
A͢J
A͢J - avatar
+ 2
Subhankar Because it's factorial is too high. Big negative numbers are values that overflowed into certain ranges; factorial(100) has more than 32 binary zeros on the end, so converting it to an integer produces zero.
11th Dec 2019, 2:18 PM
A͢J
A͢J - avatar
+ 2
Subhankar Check now for 100.
11th Dec 2019, 2:44 PM
A͢J
A͢J - avatar
+ 1
Okay thnx
11th Dec 2019, 3:47 PM
Subhankar
Subhankar - avatar
+ 1
It is working really!
11th Dec 2019, 3:47 PM
Subhankar
Subhankar - avatar
0
Man the code is good
11th Dec 2019, 1:28 PM
Subhankar
Subhankar - avatar
0
But 100! is not 0 and hence the sum is also not 0
11th Dec 2019, 1:29 PM
Subhankar
Subhankar - avatar
0
So there is really no way to calculate this sum then
11th Dec 2019, 2:47 PM
Subhankar
Subhankar - avatar
0
Well there is an error in the code I think,its not running
11th Dec 2019, 2:50 PM
Subhankar
Subhankar - avatar
0
Subhankar It's running. Check again that was by mistake.
11th Dec 2019, 3:42 PM
A͢J
A͢J - avatar