Everyone has heard of Computer Viruses but not everyone understands how they actually works.
What is it actually?
In simple terms its code that clones itself and spread over network or though removal media such as CD, DVD, US etc .
They always have purpose that is either deleting files or codes, creating errors in programs.
How they enter in your system?
Through email attachments, downloaded programs from unverified sources. It basically infects the other system related files and sometimes replicate itself to do more damages.

So now the question is how many types of computer virus are there ?
Answer is too many some of them are Program Viruses, Boot viruses, Stealth Viruses, Polymorphic Viruses macro Viruses etc etc.