Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class EvenOrOdd {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int num = Integer.parseInt(scanner.nextLine());
- if (num % 2 == 0) {
- System.out.println("even");
- } else {
- System.out.println("odd");
- }
- }
- }
- ИЛИ:
- import java.util.Scanner;
- public class EvenOrOdd {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int num = Integer.parseInt(scanner.nextLine());
- System.out.println(num % 2 == 0 ? "even" : "odd");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement