Chosen Solution

Some days ago my iphone 5 was mistakenly got wet with the swimming pool water but it worked properly but now a days it restarts again and again some drops may be stuck in the screen as it shows but it works only when it is plugged with the charging cable ; dont know the problem is the battery issue or the water remains stuck in the phone ?

It sounds like water damage. Open the phone and check if there is any water inside. If there is no water, try a new battery - if the problem is not solved - the logicboard is probably damaged.