Step-1: Search for files in the current directory. The algorithm of this virus program is as follows: #include #include #include #include #include #include FILE *virus,*host int done,a=0 unsigned long x char buff struct ffblk ffblk clock_t st,end void main() ĭownload Source code How the Virus Program Works? Here’s the source code of the virus program: The infected file will also become a virus so that when executed, it is capable of spreading the infection to another file and so on. Thus, it destroys other files by infecting them. This program demonstrates a simple virus program which when executed creates a copy of itself in all the other files that are present in the same directory. This program is an example of how to create a computer virus in C language.