Advertisement
veronikaaa86

06. Barcode Generator

Aug 13th, 2022
1,137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. package examPrep;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P06BarcodeGenerator {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         String firstNum = scanner.nextLine();
  10.         String secondNum = scanner.nextLine();
  11.  
  12.         //2345
  13.         //6789
  14.        
  15.         for (int i = firstNum.charAt(0); i <= secondNum.charAt(0); i++) {
  16.             for (int j = firstNum.charAt(1); j <= secondNum.charAt(1); j++) {
  17.                 for (int k = firstNum.charAt(2); k <= secondNum.charAt(2); k++) {
  18.                     for (int l = firstNum.charAt(3); l <= secondNum.charAt(3); l++) {
  19.                         if (i % 2 != 0 && j % 2 != 0 && k % 2 != 0 && l % 2 != 0) {
  20.                             System.out.printf("%c%c%c%c ", i, j, k, l);
  21.                         }
  22.                     }
  23.                 }
  24.             }
  25.         }
  26.     }
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement