By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 924 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

even odd with addition or subtraction logic only

P: 2
How to display whether no. is odd or even but with addition or subtraction or both logic
Jan 20 '16 #1
Share this Question
Share on Google+
4 Replies


weaknessforcats
Expert Mod 5K+
P: 9,197
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.
Jan 20 '16 #2

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

weaknessforcats
Expert Mod 5K+
P: 9,197
Did you not read that I said to subtract repeatedly?
Jan 20 '16 #4

weaknessforcats
Expert Mod 5K+
P: 9,197
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.
Jan 21 '16 #5

Post your reply

Sign in to post your reply or Sign up for a free account.