How does a Computer Virus Work?

Computer virus is a complex algorithm coded into program. Computer virus usually destroys programs. It hides in files or programs and becomes active when that file is accessed.