It’s very easy to check Even or Odd Number. You take the number and divide it by 2, If the number is divisible by 2 it’s an even number else it is odd.
import java.util.Scanner; class DecideOddEven { public static void main(String args[]) { int InputNumber; System.out.println("Enter an Integer number:"); //The input provided by user is stored in InputNumber Scanner input = new Scanner(System.in); InputNumber = input.nextInt(); /* If number is divisible by 2 then it's an even number * else odd number*/ if (InputNumber % 2 == 0) System.out.println("Entered number is even"); else System.out.println("Entered number is odd"); } }
Output 1:
Enter an Integer number:
60
Entered number is even
Output 2:
Enter an Integer number:
33
Entered number is odd
Hi Simply love the post.
Jack
I must say you have very interesting posts here. Thanks!!!!
I am in high school and just started learning and your post are really helping me…
My partner and I absolutely love your blog and find nearly all of your post’s to be precisely what I’m looking for. Again, awesome website!
Very simple and effective explanation!!!1
It is really a great and helpful piece of information. I¡¦m satisfied that you simply shared this helpful information with us. Please keep us informed like this. Thanks for sharing.
I have recently started a web site, the info you offer on this site has helped me tremendously. Thanks for all of your time and work.
I’m not that much of a internet reader to be honest but your blogs really nice, keep it up! I’ll go ahead and bookmark your site to come back later on. All the best
Hi there! This is my first visit to your blog! Nice post… Are you planning to write on Object Oriented Programming soon?
I am planning on take CS in my Senior year of high school. Really find this web site useful. Thanks for sharing.