I have done above program but it is not passing test cases

Now it’s working https://ide.codingblocks.com/s/338928