I noticed something that when I tried printing factorial of number whose value was out of bounds of the data type ; It displayed zeros continously when i gave the print command ! For instance , factorial of 100 ;
Why doesn’t the compiler rather shows an Error that the data you are trying to store is excceeding the limit ??
Problem : https://www.codechef.com/problems/FCTRL2
When the number goes out of bounds, for eg, let the range of integers be -1000 to 1000, inclusive. If you store 1001, then it will take value -1000. If you store 1002, it takes value -999. This is what actually happens.
You might be getting 100! as 0. This is because, while computing 100!, number went out of bounds and took the value 0 (precisely, 34! is saved as 0). Now any number multiplied by 0 is 0. So all factorials>=34 will give 0 as answer, and you might be wondering the reason why.
Thanks A Lot ! @ucntstopme