Example : A Java program to check Odd or Even number.

import java.io.*;
import java.util.Scanner;

class Simple
{
  public static void main(String args[])
  {
    int num;
    System.out.println("Enter an Integer number: ");    
    Scanner Sc = new Scanner(System.in);
    num = Sc.nextInt();    
    if ( num % 2 == 0 )
        System.out.println("Entered number is Even");
    else
        System.out.println("Entered number is Odd");
  }
}

Loading

Categories: Java

0 Comments

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.