code resulting in failed test cases but i think that the code is right.
@Riya.ty6 share your code using cb ide so that i can check
https://ide.codingblocks.com/s/286048 this is the link
@Riya.ty6 corrected and commented dont forget to hit like and mark resolved if cleared
this is the correct link
@Riya.ty6 see above i have corrected your code giving it once again