Advertisement
Md_Nabeel

Java program to check Even or Odd

Oct 9th, 2021
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1. import java.util.*;
  2. public class Main
  3. {
  4.     public static void main(String[] args)
  5.     {
  6.         int a;
  7.         Scanner in = new Scanner(System.in);
  8.         System.out.println("Enter a no: ");
  9.         a = in.nextInt();
  10.         if (a % 2 == 0)
  11.          {
  12.             System.out.println("The given number is even");
  13.         }
  14.         else
  15.          {
  16.             System.out.println("The given number is odd");
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement