Tuesday, 16 January 2018

Program to show that entered number is Even or Odd

Source Code :

//Program to show that entered number is Even or Odd

import java.util.*;

class evenOdd
{
    public static void main(String args[])
    {
        int no;
        Scanner sc = new Scanner(System.in);       
        System.out.print("\n Enter Any Integer : ");
        no=sc.nextInt();

        if(no%2==0)
        {
             System.out.println("\n Even ");
        }
        else
        {
             System.out.println("\n Odd ");
        }
    }
}

Output Screen : 


No comments:

Post a Comment