Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to Check If Number is Even or Odd without using Modulus or Remainder Operator? Example

Write a Java program to find if a number is odd or even is one of the basic programming exercises, and anyone will be happy to see this in actual Java Interviews, wouldn't you? By the way, did I said easy, well there is a little twist there, you need to check odd and even without using modulus (%) or Remainder Operator in Java. Since many programmers, especially freshers are familiar with % operators, this nice little trick does put them into thinking mode, which is what the interviewer wants. This question is on a similar level of checking if a number is a palindrome or not if you have practiced such questions, it would be easy to find a solution.


This post first appeared on Javarevisited: Blog About Java Programmin, please read the originial post: here

Share the post

How to Check If Number is Even or Odd without using Modulus or Remainder Operator? Example

×

Subscribe to Javarevisited: Blog About Java Programmin

Get updates delivered right to your inbox!

Thank you for your subscription

×