Find Odd or Even Program in Java

Prev Tutorial Next Tutorial

Java Program to Find Odd or Even number

In below code i will show you how to design Java Program to Find Odd or Even number. In this program we receive input value from keyboard and find modulo 2 (num%2) of number if reminder of number is zero then that number is even other wise odd. Even numbers are those which are divisible by 2, and which numbers are not divisible 2 is called odd numbers.

Java Program to Find Odd or Even

import java.util.Scanner;
class Oddeven 
	public static void main(String[] args) 
    int no;
	Scanner s=new Scanner(;
    System.out.println("Enter any number :");
	System.out.println("Even number");
	System.out.println("Odd number");


Enter any number : 
Even number

Syntax to compile and run java program


for compile -> c:/javac
for run -> c:/java Oddeven

Explnation of Code

  • Scanner s=new Scanner( are used for receive input from keyboard.
  • nextInt(): method are used for get integer type value from keyboard.
  • System.out.println("....."): are used for display message on screen or console.

Prev Tutorial Next Tutorial

Download Projects

Google Adsense Advertisements
Free Classified Site – Bedpage

Yahoo Advertisements