I was trying the basic battleship game but problem is whenever I enter the input, the loop terminates and if I remove "sunk=true" then alert only shows "missed" which runs infinitely.
what should be the code?
![enter image description here][2]
There is a few things I would update, but I don't want to give you everything at once as this looks like a school project. Your "pro" variable should be inside the while loop. If you remove "sunk=true" the while loop will run forever as pro does not equal any of the locations (second else if). Pro is outside of the loop so you never get prompted for a new number and it continuously hits missed indefinitely.