Why am I getting SIGFPE error on this simple SPOJ question?

Here is the problem:

Here is the code:

I took care of all the corner cases still I’m getting SIGFPE.
I tried taking long long too but same error.

Check this link out…JDzsNs - Online C++ Compiler & Debugging Tool - Ideone.com

Hope this helps…:slight_smile:

ohhh damnm!! didn’t even see the constraints properly…thanks :smiley:

1 Like

Happens!!!