This problem of automatic shutdowns might be coming from different issues. You should check whether your hardware components are not faulty. Firstly check the power supply cable. The cable may be damaged and this will only be solved by replacing it. The graphic card should be checked together with the motherboard. If you don't have the required materials for checking it, you can place it on another computer to see if it is not faulty. Yet, the RAM memory might be messing up. Please check whether you should have it upgraded in order to have the PC functioning properly.