Chewbaca and numbers not working

Hello @Abhishek-Ghosh-2306223462800568,

There are multiple issues with your code:

  1. The range of x is much higher than the range of int.
    Read the constraint carefully.
    Solution:
    use long long as datatype

  2. Also, you are not considering the case when the leftmost digit is 9
    Example 1:
    9876
    Your Output:
    123
    Expected Output:
    9123
    Example 2:
    9999
    Your Output:
    0
    Expected Output:
    9000

  3. You are not getting any output because your code has stuck into infinite loop.
    Reason:
    n/10 ;
    (This won’t change the value of n)
    Solution:
    n=n/10 ;

Hope, this would help.
Give a like if you are satisfied.

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.