Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class BarcodeGenerator {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int num1 = Integer.parseInt(scanner.nextLine());
- int num2 = Integer.parseInt(scanner.nextLine());
- int f1 = num1 / 1000;
- int f2 = num1 / 100 % 10;
- int f3 = num1 / 10 % 10;
- int f4 = num1 % 10;
- int s1 = num2 / 1000;
- int s2 = num2 / 100 % 10;
- int s3 = num2 / 10 % 10;
- int s4 = num2 % 10;
- for (int i = 1; i <= 9; i++) {
- for (int j = 1; j <= 9; j++) {
- for (int k = 1; k <= 9; k++) {
- for (int l = 1; l <= 9; l++) {
- if ((i % 2 == 0 || i == 1) && i >= num1 && i <= num2) {
- if ((j % 2 == 0 || j == 1) && j >= num1 && j <= num2) {
- if ((k % 2 == 0 || k == 1) && k >= num1 && k <= num2) {
- if ((l % 2 == 0 || l == 1) && l >= num1 && l <= num2) {
- System.out.printf("%d%d%d%d", i, j, k, l);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment