239
submitted 3 weeks ago by [email protected] to c/[email protected]
you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 2 points 3 weeks ago

Huh, I had never considered this solution to fizzbuzz to be honest. I usually go for string concatenation, or (i % 3 == 0 && i % 5 == 0), but yeah i % 15 == 0 is certainly a clever simplification

[-] [email protected] 2 points 3 weeks ago

I think it's worse at conveying the intention and should be a compile-time simplification (I'm too lazy to check if compilers would do it though).

this post was submitted on 09 May 2025
239 points (98.8% liked)

Programmer Humor

35949 readers
103 users here now

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

Rules:

founded 5 years ago
MODERATORS