Advertisement
veronikaaa86

06. Barcode Generator

Nov 13th, 2021
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 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 first = scanner.nextLine();
  10. String second = scanner.nextLine();
  11.  
  12. //2345
  13. //6789
  14. for (int i = first.charAt(0); i <= second.charAt(0); i++) {
  15. if (i % 2 == 0) continue;
  16. for (int j = first.charAt(1); j <= second.charAt(1); j++) {
  17. if (j % 2 == 0) continue;
  18. for (int k = first.charAt(2); k <= second.charAt(2); k++) {
  19. if (k % 2 == 0) continue;
  20. for (int l = first.charAt(3); l <= second.charAt(3); l++) {
  21. if (l % 2 == 0) continue;
  22.  
  23. System.out.printf("%c%c%c%c ", i, j, k, l);
  24.  
  25. // if (i % 2 != 0 &&
  26. // j % 2 != 0 &&
  27. // k % 2 != 0 &&
  28. // l % 2 != 0) {
  29. // System.out.printf("%c%c%c%c ", i, j, k, l);
  30. // }
  31. }
  32. }
  33. }
  34. }
  35. }
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement