this post was submitted on 15 Jul 2025
461 points (94.9% liked)

Programmer Humor

37339 readers
428 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 6 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] thann@lemmy.dbzer0.com 9 points 1 week ago (8 children)

You could use a loop to subtract 2 from the number until it equals one or zero

[–] TimeSquirrel@kbin.melroy.org 8 points 1 week ago (7 children)

Or literally just look at its binary representation. If the least significant digit is a "1", it's odd, if "0", it's even. Or you can divide by 2 and check for a remainder.

Your method is just spending time grinding away CPU cycles for no reason.

[–] FunkyStuff@hexbear.net 3 points 1 week ago (1 children)

are you my TA that I mentioned in the other comment

[–] TimeSquirrel@kbin.melroy.org 3 points 1 week ago

Maybe. And I can't blame it on not having had coffee when I made the comment. Just me being completely oblivious to a joke.

load more comments (5 replies)
load more comments (5 replies)