I hope you came looking for how do people make “computer viruses” (because making human viruses is a different topic)
Programmers and non-programmers, both make viruses for many reasons including just to make a virus and then trying to combat it, or to employ black hat techniques to get some benefit for their website etc.
Ok let me tell you first, this post is not a tutorial on how to code a virus straight away, but just to give you an idea how do the people, who make viruses, make one.
How do people make a virus
1. By mistake
Obviously, not the needed answer, but thats one of the way they get a virus too. Most of the time some errors in code, instead of making it fail, make it act as a virus
2. By copy pasting codes
This is what most of people online are doing. Just going online and searching for some code, copying it, making a virus and then teasing and damaging their friends.
3. By coding themselves
Any programmer, who know a programming language, and knows how computer or servers work, can make a virus. This is the real way to make viruses (or worms and trojans).
So in short, if you want to code a virus (which you shouldn’t want anyway) first learn a programming language and you won’t be asking this question again. Sometimes because you will know how to code a virus, and sometimes, because you will no longer wish to know how to make a virus anymore.