When you connect to the internet you need to be careful. It is not your fault that your system got viruses, however you should take the precaution methods to stop this from happening again. Security software and other similar products were created to protect your System(PC/Laptop/Smartphone etc.) and your Identity.
1) Keep System Clean: It is important that your System stays clean if you use the internet. Clean from spyware, adware or viruses. Don’t access malicious websites.
2) A must use Software: Install a reputed Security software which has anti-virus,firewall etc.. There is no need to purchase 30 different kinds of softwares.
3) Schedule Maintenance: You should scan your complete system atleast once a week using the installed security software. Enable auto-scheduling using the security software settings.
4) Safety Measurements: If you download software/movies/images/videos or any other thing from the internet it is recommended that you scan those items. Before opening them right click on them and use your security software to scan them.