0

The following code do not work after 17. I want to make it work for no. As large as 1000

https://code.sololearn.com/c3SvDbm9qZ4x/?ref=app

20th Apr 2020, 11:01 AM
Aman Porwal
4 Answers
+ 1
Because of overflow.. Result exceeding long long int range.
20th Apr 2020, 11:31 AM
Jayakrishna 🇼🇳
0
As i read from previous comments you are overflow the 4 bytes. So 1 use not int but long, also instead of long you can use long long.BUT According to factorial we know that factorial is positive number so you do not need negative part of datatype. Change variables to unsigned long long to get possibility calculate N > value witch is overflow with int.
20th Apr 2020, 11:48 AM
george
george - avatar