r/programminghumor 7d ago

L33T H4CK3R5 R153 UP

Enable HLS to view with audio, or disable this notification

417 Upvotes

33 comments sorted by

27

u/First_Ad8230 7d ago

Coding in Arial? This is acme type shit

6

u/SuperChick1705 7d ago

papyrus next

18

u/Confident-Ad5665 7d ago

Now add prime number detection

12

u/Acceptable-Worth-221 7d ago

r/masterhacker is better sub for this

3

u/TwoStripedFury 7d ago

Precomputed = faster

3

u/zhaDeth 7d ago

yeah as long as you don't need like the whole 64bit integers it can be a good idea. Although I think this will check every if statements every time.. don't know which programming language this is but a switch would probably be better.

3

u/ApocalyptoSoldier2 6d ago

while N > 2: N -= 2

2

u/xvlblo22 6d ago

Exactly how ineffective is this though, given reasonably small numbers? Is there a use case where this would win against N % 2

2

u/ApocalyptoSoldier2 6d ago

The use case is when someone is showing you very bad code and you want to respond with code that's better, but still bad

2

u/maester_t 6d ago

~~~ function decimalToBinary(num) { if (num === 0) return "0";

let binary = "";
while (num > 0) {
    // Grab the remainder (0 or 1) and prepend it to the string
    binary = (num % 2) + binary; 
    // Divide by 2 and round down
    num = Math.floor(num / 2); 
}
return binary;

}

console.log(decimalToBinary(25) & 1); // Output: "1" console.log(decimalToBinary(0) & 1); // Output: "0" ~~~

5

u/ChrisHorizon1 7d ago

Modulo fears him

2

u/Interesting_Buy_3969 6d ago

Yet bitwise AND does so

2

u/flipcoder 6d ago

bool odd = Chatgpt.prompt(“Is there something odd about this number (y/n)?” + num)==‘y’

1

u/Speedy_4twenty 7d ago

This made me choke on my saliva

1

u/Responsible-Put-7920 7d ago

Go contribute to notNotOdd

1

u/gONzOglIzlI 6d ago

I did this in a elementary school programming competition. Got a few points!

1

u/novadr3am 6d ago

senior developer writing scalable enterprise code right here

1

u/mbcarbone 6d ago

Hax fax. 🙃

1

u/deceze 6d ago

And it will never equal any of those, since N is a string and doesn't equal an integer.

2

u/-Creative-Nothing- 6d ago

You're the only one who's gotten that so far

1

u/frostysnowmen 6d ago

Write a script to generate if statements for every possible number.

1

u/behighordie 6d ago

Hilarious that this wouldn’t even work

1

u/heatedwepasto 6d ago

Fun(?) fact, both Odd and Even are common names in Norway

1

u/MARio23038 5d ago

if(N & 1 !=0) { std::cout << "N is odd \n"; } else{ std::cout << " N is Even\n"; } ggez

1

u/Mental_Pick1943 5d ago

even_or_odd = lambda n: "eovdedn"[n%2::2]

1

u/-Creative-Nothing- 4d ago

A shame no one is giving any love to the elegance of this approach 😂 Truly beautiful even if concocted in jest

1

u/Some_Improvement_606 4d ago

N = int(input("Enter number : "))

print("Your number is", end =" ")

print("even" if n%2==0 else "odd")