Java Program to Check Given Number is even or odd

0
Share

In this program, you’ll learn to Given Number is even or odd in Java. After write the code, the final output is displayed on the screen.

Example – Given Number is even or odd

import java.util.*;
public class EvenOdd{
    public static void main(String arg[]){
        Scanner sc=new Scanner (System.in);
        System.out.println("Enter the number : ");
        int number=sc.nextInt();
        if(number%2==0){
            System.out.println("Given number is a Even number");
        }
        else{
            System.out.println("Given number is a Odd number");
        }
    }
}

Output

Enter the number : 54
Given number is a Even number

Read more post

  • What are the List of CSS3 New Features ?
    CSS3 is the latest version of the normal CSS . CSS3 adds several new styling features and improvements to enhance the web presentation capabilities. Text Effect in...
  • CSS Basic Property
    What is CSS ? CSS stands for Cascading Style Sheets. CSS basically used in designing the web tags & pages. CSS is the most popular used...
  • Java Program to swap two number use 3rd variable
    In this program, you’ll learn to Program to swap 2 number with 3rd variable in Java. After write the code, the final output is displayed on...
  • Java program to multiply two floating point number
    In this program, you’ll learn to Program to multiply two floating point number in Java. After write the code, the final output is displayed on the...
  • Java Program to find the ASCII value of a character
    In this program, you’ll learn to Program to find the ASCII value of a character in Java. After write the code, the final output is displayed...
  • Java Program to calculate quotient & reminder
    In this program, you’ll learn to Given Number is even or odd in Java. After write the code, the final output is displayed on the screen....
%d bloggers like this: