Check Even or Odd Number:

public class EvenOdd {

 public static void main(String[] args) {

 int num = 5;

 if(num % 2 == 0)

 System.out.println(num + ” is even.”);

 else

 System.out.println(num + ” is odd.”);

 }

Output:

5 is odd.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *