Getting wrong ans

question -https://leetcode.com/problems/divide-two-integers/

my solution -https://ide.codingblocks.com/s/475918

why i am getting num=0 for i=31, 30 29 in my code and how i can correct my code

hello @shivamgoel150

typecast ur divisor to long long and then try.

because of overflow it is giving 0

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.