163
Rule (lemmy.blahaj.zone)
submitted 5 hours ago by Persona3Reload to c/196
you are viewing a single comment's thread
view the rest of the comments
[-] lnxtx@feddit.nl 7 points 5 hours ago

Ask AI:

public static boolean isEven(int number) {
    // Handle negative numbers
    if (number < 0) {
        number = -number; // Convert to positive
    }
    
    // Subtract 2 until we reach 0 or 1
    while (number > 1) {
        number -= 2;
    }
    
    // If we reach 0, it's even; if we reach 1, it's odd
    return number == 0;
}
[-] Sanctus@lemmy.world 12 points 4 hours ago

Anything but using modulo I guess

[-] YtA4QCam2A9j7EfTgHrH@infosec.pub 4 points 4 hours ago

This makes me happy that I don’t use genai

this post was submitted on 31 Oct 2024
163 points (100.0% liked)

196

16408 readers
1812 users here now

Be sure to follow the rule before you head out.

Rule: You must post before you leave.

^other^ ^rules^

founded 1 year ago
MODERATORS