Decode School

Decode School - The School for Problem Solvers

Welcome to my blog. Subscribe and get my latest blog post in your inbox.

Java Program to find whether the given number is odd or even number

Get a number num and check whether num is odd or even?

Sample Input 1:


Sample Output 1:


Sample Input 2:


Sample Output 2:


Program or Solution


Program Explanation

Get input input1 from user using scanner class check whether the remainder of input1 divided by 2 is equal to 0 using if statement.

if it is 0, then print input1 is even using system.out.println.

Else print input1 is odd using system.out.println.