What is the error in this as its passing only 1 test case?

@Ak07 hey there is problem in logic ,check this corrected code :https://ide.codingblocks.com/s/219604