import java.io.*; import java.lang.*; class EvenOdd { public static void main(String args[])throws IOException { int n=0; BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter number: "); n=Integer.parseInt(br.readLine()); n=n%2; if(n==0) System.out.println("The given number is even "); else System.out.println("The given number is odd "); } }
OUTPUT:
Compilation: javac EvenOdd.java Run : java EvenOdd Enter number: 10 The given number is even