Advertisement
Spocoman

04. Car Number

Aug 30th, 2024
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class CarNumber {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int startNum = Integer.parseInt(scanner.nextLine());
  7.         int finalNum = Integer.parseInt(scanner.nextLine());
  8.  
  9.         for (int i = startNum; i <= finalNum; i++) {
  10.             for (int k = startNum; k <= finalNum; k++) {
  11.                 for (int j = startNum; j <= finalNum; j++) {
  12.                     for (int x = startNum; x <= finalNum; x++) {
  13.                         if ((i % 2 == 0 && x % 2 == 1 || i % 2 == 1 && x % 2 == 0)
  14.                                 && i > x && (k + j) % 2 == 0) {
  15.                             System.out.printf("%d%d%d%d ", i, k, j, x);
  16.                         }
  17.                     }
  18.                 }
  19.             }
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement