All test cases not passing

Supratik, it is better to use do while loop in the question … Pls change your approach according to that only…