Java Program:

- To print whether number is even or odd

Example:

User Input: 3

Output: Odd Number

import java.util.Scanner;
public class EvenOrOdd {
  public static void main(String []args) {
    int num;
    Scanner userInput = new Scanner(System.in);
    System.out.print("Enter your number : ");
    num = userInput.nextInt();

    if(num%2==0)System.out.println("Even Number");
    else System.out.println("Odd Number");
  }
}

Output:

  Enter your number : 4
  Even Number
Program
basic

You should know first :

Even numbers: Numbers perfectly divisible by 2

(number % 2 == 0)

Odd numbers: Numbers not perfectly divisible by 2

(number % 2 != 0)

you can use any one of the above as condition and in else portion just print the other one

Concept

Coming Soon !

Quick
Tutorial

Quote

Make bold choices and make mistakes. It’s all those things that add up to the person you become.