How old is the pc? This actually happened to me when I first built my pc. The issues was something I downloaded which kept crashing my pc. I contacted Microsoft support and they had me disable some programs I forget what I ran for that. A possible fix is to clean boot your pc if it’s a software issue
It's unlikely to be bad ram. It could also be an out of date video driver, an overheating issue, faulty cpu, not enough power being provided by the power supply, failing storage media, a bad install... the list goes on. It's best to get it diagnosed by a professional.
Thanks! Your answer is awaiting moderation.