Showing posts with label even odd. Show all posts
Showing posts with label even odd. Show all posts

Saturday 14 May 2016

Java code to check given number is even or odd


import java.util.Scanner;

public class CheckEven {
   
   
    public static void main(String args[])
    {
    Scanner ob= new Scanner(System.in);
    int a;
    System.out.println("Enter an integer");
    a=ob.nextInt();
    if(a%2==0)
        System.out.println("The Entered number is even");
    else
     System.out.println("The Entered number is odd");  
    }
   
   
}