7:43 pm - Sunday September 23, 2018

Java example program to check whether the number is odd or even

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
/*program to find whether the given number is odd or even*/
/**
@author:candidjava.com
@Description: check the given number to know whether it is odd or even
*/

public class Evenodd {
	public static void main(String args[]) {
		int a = 70;
		if ((a % 2) == 0)
			System.out.print("Number is even");
		else
			System.out.println("number is odd");
	}
}

Output:

Number is even

Filed in: Sample Programs in java

Comments are closed.