What happens to ans when String > 10

I tried inputting string with a length greater than 10 and the ans started going negative and completely different from the input. Can u pls explain why?

Hey @code_breaker-1001 You are getting unexpected output bcoz when you try to give string length greater than 10 then converted int value will not be in the size range of Integer since 10 digit int is out of range of int.

ohhk Thnk u…

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.