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