Screen goes black occasionally

Occasionally the screen on my HP All in One Computer TOUCHSCREEN 24" Windows 10 8GB 1TB DVD+RW goes black for a few seconds. Myu friend has an HP desktop with a tower and it does the sdame thing. What's the problem?
Update the video drivers see if that helps run a antivirus and anti malware scan but I can’t see that being the problem
Also your graphics card might be on the way out
How old is the computer