• lobut@lemmy.ca
    link
    fedilink
    arrow-up
    44
    ·
    8 months ago

    Just do a while loop and subtract 2 if it’s positive or plus 2 is it’s negative until it reaches 1 or 0 and that’s how you know, easy! /s

    • KoboldCoterie@pawb.social
      link
      fedilink
      English
      arrow-up
      44
      ·
      8 months ago

      God, it’s so obvious, you can do it in only two lines of code.

      if (number == 1 || number == 3 || number == 5 || number == 7 || number == 9...) return false;
      else return true;