Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class EvenOddNum {
  4. public static void main(String[] args) {
  5. int x;
  6. System.out.println("Enter a number to check if it's odd or even");
  7. Scanner in = new Scanner(System.in);
  8. x = in.nextInt();
  9. int y = x % 2;
  10. System.out.println((y == 2) ? "Number is even":"Number is odd");
  11. }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement