Try the following steps then, this might not work but it is worth a try.
First reset the System Management Controller of your Mac. Follow the steps below;
Shut down the computer.
Plug in the power adapter to a power source, connecting it to the Mac if not already connected.
On the built-in keyboard, press the (left side) Shift-Control-Option keys and the power button at the same time.
Release all the keys and the power button at the same time.
Press the power button to turn on the computer.
If that didn't work, then reset the PRAM and NVRAM of your Mac. Follow the steps below;
Shut down your Mac
Restart and immediately hold down Command-Option-P-R keys at the same time
Hold the keys down until the computer restarts and you hear the startup sound for two or three times.
Release the keys and let the Mac boot up.
If it still not working, then you will have to replace the RAM. You can find the instructions in this article to know how to remove the memory --> https://support.apple.com/en-in/HT201165
There is nothing wrong with other parts of the Mac. It is with the RAM memory of the Mac. Try it. It is pretty easy and user removable.
Let me know how it goes