We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.
import java.io.*;
class even_odd {
public static void main(String args[ ]) {
int no;
no = Integer.parseInt(args[0]);
/* Check the modulus of 'no' is zero or not */
if (no % 2 == 0)
System.out.println("It's a Even Number");
else
System.out.println("It's a Odd Number");
}
}
/* Output */
java even_odd 4
It's a Even Number
/* ------------------------- */
java even_odd 5
It's a Odd Number