even odd with addition or subtraction logic only

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • taranjeet
    New Member
    • Jan 2016
    • 2

    even odd with addition or subtraction logic only

    How to display whether no. is odd or even but with addition or subtraction or both logic
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    A number is even if it is evenly divisible by 2.

    Just starting tracing 2 over and over from your number until the remainder is less than 2.

    If the remainder is 0 the number was even. Otherwise it was odd.

    Comment

    • taranjeet
      New Member
      • Jan 2016
      • 2

      #3
      Not in accordance with question.. Without divide , multiply i only want addition or subtraction logic.. By the thank u for ur concern. :-)

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        Did you not read that I said to subtract repeatedly?

        Comment

        • weaknessforcats
          Recognized Expert Expert
          • Mar 2007
          • 9214

          #5
          For addition only, start with 0 and add 2 repeatedly. If the result eventually equals the number, the number is even. Otherwise, it is odd.

          Comment

          Working...