This article explains how to check a typical desktop computer for loose or improperly connected power cables. This could be the culprit if your computer won't turn on or shuts down abruptly.
Power cables often become disconnected from PC cases over time, or sometimes after being moved. Checking each point where electricity is supplied to the computer system is usually a first step when a computer is not receiving power.
The first place to start is with the power cord that plugs into the back of the computer case. It should fit snugly into the three pronged port on the power supply.
Follow the power cord from the back of the computer case to the electrical outlet, surge protector, or power strip it is (or should be) plugged into. If your PC is plugged into a battery backup unit, follow the cord there.