Bad Programming Challenge
I heard a friend in comp sci was giving a assignment to make the worst program to add 3 numbers. It had this whole lesson to teach people to use good programming practices by adding in a twist. -after everyone had written thire programs they exchanged them with a classmate and the classmate had to modify it. The point of this assignment was with programming alot of the time you'll find yourself reading other peoples code and it may come across as incomprehensible or be just plain poorly written...it ended with the quote "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." The point of this is not to encourage bad programming practices. When writeing code that will be used for anything useful you should always code for readability-however as a challenge it seemed kinda fun so if anyone wants to try writeing the worst addition program feel free to join me. it can be as obviously or as obfuscated as you like the only requirement is for it to add 3 (user defined) numbers and output thire result. A quick c example for obsfucating it unduly https://code.sololearn.com/cwyIdpHn1TkG/#c #include <stdio.h> #define magic(A,B,C) asm("addl %%ebx,%%eax \n\t addl %%ecx, %%eax \n\t movl %%eax, %%ebx \n\t andl $0x507A1014, %%eax \n\t movl %%ebx, %%ecx \n\t andl $0x86044A81, %%ebx \n\t andl $0x2981A56A, %%ecx \n\t":"=a"(A),"=b"(B),"=c"(C):"a"(A),"b"(B),"c"(C)) int main() { int A=10,B=42,C=53; //default numbers replace with your own by adding 3 numbers scanf("%d %d %d",&A,&B,&C); magic(A,B,C); printf("%d",A^B^C); return 0; } I also made a github randomly https://github.com/BlueLightning42/Bad-Addition Either way if anyone posts a code feel free to try to decode it and change it so that it takes the first number and subtracts the second two numbers from it-it can be a lesson in deciphering other peoples codes or simply for fun.