I understand that your PC shuts down intermittently.
Don't worry I will try to help you out.
Did you make any software or hardware or changes on your PC?
Please provide the product number of your PC to assist your better.
Please try the steps recommended below.
Many hardware drivers or operating system errors will cause the computer to display a specific error message before stopping the operation or shutting down the computer. However, if the Automatically restart option is enabled, an error message might not be displayed despite an error taking place. Disable this option to allow the computer to display the error message.
Follow these steps to disable the Automatically restart option:
In Windows, search for and open View advanced system settings.
Click Settings in the Startup and Recovery section.
Remove the check mark next to Automatically restart under System Failure, then click OK.
Restart the computer.
The computer no longer restarts automatically when a problem occurs. Instead, a blue screen appears with more useful information. You can now search for a resolution using the information in the error.
Refer this article further troubleshoot Computer Restarts Unexpectedly.