The only way to completely protect your computer from viruses is to not connect your computer to the Internet, not connect your computer to a home or corporate network, and not share files with any other computer users. For most users, these actions are too extreme.
For the typical home computer user, there are less drastic steps you can take to reduce the risk of virus infection. These include the following:
Do not open email attachments from people you don't know — or even from people you do know, if you aren't expecting them.
Only download files from reliable websites.
Do not click links sent to you from strangers via instant messaging or in a chat room. Don’t click links from someone you do know, unless you are sure that they intended to send you that link
Only share disks and files with users you know and trust.
Install an anti-virus program on your PC
Regularly check for security updates for your operating system or, better yet, configure your operating system to automatically check for, download, and install all available updates.