Java Programming

Even Odd

Java programming example for checking the given number is even or odd

9/4/2021
0 views
even-odd.javaJava
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
Even NumberOdd Numbereven odd calculationJava tutorial

Loading comments...

Related Examples

Deliver breaking news, insightful commentary, and exclusive reports.

Targeting readers who rely on our platform to stay ahead of the curve.

Contact Us: benzingaheadlines@gmail.com