Wrong answer coming

Modified Code
2 mistakes

  1. intialize x with 0
  2. print each testcase in seperate line
    https://ide.codingblocks.com/s/249216

now it is passing all testcase

i hope this help
if you have more doubts regarding this feel free to ask
if your doubt is resolved mark it as resolved from your doubt section inside your course