Sat. Sep 26th, 2020

Program To Check Whether the Number Is Even or Odd in Java

import java.util.Scanner;
 class OddEven
 {
     public static void main(String args[])
 {
 int x;
 Scanner sc=new Scanner(System.in);

    System.out.print("Enter the Number:"); //take input by //user

       x=sc.nextInt();

 if(x%2==0)

    {

    System.out.print(" Number is even.");

    }
        else
   {
            System.out.print("Number is odd.");
       
        }    
     
      }
  
}

READ MORE

Leave a Reply

Your email address will not be published. Required fields are marked *