How can I stop my iPhone 5c from shutting off randomly?

My iPhone 5c keeps shutting off randomly

Tonight when I was on my phone it randomly turned off and the basic apple logo start up screen came on but that keep flashing on and off as well. I plugged it into my charger, it turned on, and the battery said 100% ?? Just then it shut off again, and a bit before that the screen was all glitched out?? How do I fix this and what is causing this?
Re: My iPhone 5c keeps shutting off randomly

Welcome to iMore!

Try a hard reset on it. Hold the power & home button at the same time until you see the  logo, then release them. This may solve the issue. If this does not solve the problem it could be a hardware issue and you will need to make a Genius appointment and have it looked at. I can not tell you what the issue is directly as it could be hardware or software related.

Original thread: https://forums.imore.com/threads/how-can-i-stop-my-iphone-5c-from-shutting-off-randomly.363217/