0
The following code do not work after 17. I want to make it work for no. As large as 1000
4 Réponses
+ 1
Because of overflow..
Result exceeding long long int range.
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.