This article explains how to reinstall the operating system on a PC or Mac. This is usually the solution to solve all problems resulting from a corrupt operating system or one that has been infected with a virus. Before reinstalling the operating system you should always back up your data using an external hard drive.
Steps
Method 1 of 2: Windows

Step 1. Access the "Start" menu by clicking on the icon
The latter depicts the Windows logo and is located in the lower left corner of the desktop.

Step 2. Access the "Settings" menu by clicking on the icon
It features a gear and is located at the bottom left of the "Start" menu.

Step 3. Click on the "Update and Security" icon
It is displayed in the lower right of the "Settings" window.

Step 4. Click on the Restore tab
It is listed in the left pane of the window.

Step 5. Click the Get Started button
It is located within the "Reset your PC" section displayed at the top of the page.

Step 6. Click the Remove All option when prompted
It is displayed at the top of the pop-up window that appears.

Step 7. Click on Remove files and clean the drive
This will format your computer's hard drive, after which the Windows 10 operating system will be reinstalled.
An informational warning may appear on the screen explaining that it will not be possible to restore a previous version of Windows by continuing in the direction you have chosen. In this case, press the button Come on to continue.

Step 8. Click the Reset button when prompted
The computer will be reset.

Step 9. Wait for the Windows formatting and reinstallation process to complete
This step may take several hours to complete, so make sure your computer is plugged in to prevent it from accidentally turning off.

Step 10. Click the Continue button when prompted
When the Windows reinstallation phase is complete, the indicated button will appear at the top of the screen. This will start the initial setup procedure of the operating system.

Step 11. Follow the instructions that will appear on the screen
You will need to select the language, connect to the Wi-Fi network and perform all the other Windows 10 configuration and customization operations that will allow you to complete the installation.
Method 2 of 2: Mac

Step 1. Access the "Apple" menu by clicking on the icon
It features the Apple logo and is located in the upper left corner of the screen. A drop-down menu will appear.

Step 2. Click on the Restart… option
It is listed at the bottom of the drop-down menu that appeared.

Step 3. Click the Restart button when prompted
The Mac will restart.

Step 4. Put your Mac in "Recovery" mode
Immediately after clicking on the button Restart, press and hold the ⌘ Command + R key combination until the "macOS Utility" system window appears on the screen.

Step 5. Select the Disk Utility option
It has a gray hard drive icon.

Step 6. Click the Continue button
It is displayed in the lower right corner of the window.

Step 7. Select your Mac's primary hard drive
It is listed in the left pane of the window. This is the hard drive on which the macOS operating system is installed.

Step 8. Click on the Initialize tab
It is visible at the top of the right window pane. A pop-up window will appear.

Step 9. Click on the "Format" drop-down menu
It is located inside the right pane of the window. A list of options will be displayed.

Step 10. Click on the Mac OS Extenso option
It is one of the items in the "Format" drop-down menu.

Step 11. Click the Initialize button
It is located in the lower right corner of the window.

Step 12. Wait for the Mac hard drive to be formatted
This step may take a while to complete, so make sure your Mac is plugged into the mains via the AC adapter to prevent it from accidentally shutting down.

Step 13. Click the Finish button when prompted
In this way the disk initialization phase will be complete.

Step 14. Click on the Disk Utility menu
It is displayed in the upper left of the screen.

Step 15. Click on the Exit Disk Utility item
It is the last option on the drop-down menu Disk Utility. This will redirect you to the main menu of the "macOS Utilities" window.

Step 16. Select the MacOS Reinstall item, then click the button Continues.
The Mac operating system will be automatically reinstalled on your computer's hard drive.
Step 17. Follow the instructions that will appear on the screen
Once the macOS operating system has been reinstalled, you will be able to perform the initial setup of the Mac by choosing the language, connecting to the Wi-Fi network, and so on.