Java Program To Find Odd or Even Numbers - Java Program With Example

Java Program To Find Even Or Odd Numbers. I Am Share A Java Program Code We Can Find Even Or Odd Number Using This Java Program Code. When We Compile This Program Compiler Take An Input And Show Output Number Is Even Or Odd Which Number Entered By User.

Program Code

package com.androidpro.in;

import
java.io.BufferedReader;
import
java.io.IOException;
import
java.io.InputStreamReader;
import
java.io.PrintStream;
import
java.util.Scanner;

public class
Main {

   
public static void main(String args[])
    {
       
int x;
       
System.out.println("Enter A Number To Check Odd Or Even Number ");
       
Scanner in = new Scanner(System.in);
       
x = in.nextInt();
        if
( x % 2 == 0 )
            System.
out.println("Your Entered Number Is  :  ''Even Number'' ");
        else
           
System.out.println("Your Entered Number Is  :  ''Odd Number''");
   
}


}


Output

Enter A Number To Check Odd Or Even Number 

565

Your Entered Number Is  :  ''Odd Number'' 

566

Your Entered Number Is  :  ''Even Number'' 

Post a Comment

0 Comments