Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class EvenOddNum {
- public static void main(String[] args) {
- int x;
- System.out.println("Enter a number to check if it's odd or even");
- Scanner in = new Scanner(System.in);
- x = in.nextInt();
- int y = x % 2;
- System.out.println((y == 2) ? "Number is even":"Number is odd");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement