desislava_topuzakova

Untitled

Oct 18th, 2021
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. package Exam18_19July2020;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class BarcodeGenerator2_06 {
  6. public static void main(String[] args) {
  7. Scanner scan = new Scanner(System.in);
  8.  
  9. int rangeIn = Integer.parseInt(scan.nextLine());
  10. int rangeOut = Integer.parseInt(scan.nextLine());
  11.  
  12. int firstDigitIn = (rangeIn / 1000) % 10;
  13. int secondDigitIn = (rangeIn / 100) % 10;
  14. int thirdDigitIn = (rangeIn / 10) % 10;
  15. int fourthDigitIn = rangeIn % 10;
  16.  
  17. int firstDigitOut = (rangeOut / 1000) % 10;
  18. int secondDigitOut = (rangeOut / 100) % 10;
  19. int thirdDigitOut = (rangeOut / 10) % 10;
  20. int fourthDigitOut = rangeOut % 10;
  21.  
  22.  
  23. for (int i = firstDigitIn; i <= firstDigitOut; i++) {
  24. for (int j = secondDigitIn; j <= secondDigitOut; j++) {
  25. for (int k = thirdDigitIn; k <= thirdDigitOut; k++) {
  26. for (int l = fourthDigitIn; l <= fourthDigitOut; l++) {
  27. if (i%2 != 0 && j%2 != 0 && k%2 != 0 && l%2 != 0) {
  28. System.out.printf("%d%d%d%d ", i, j, k, l);
  29. }
  30. }
  31. }
  32. }
  33. }
  34.  
  35.  
  36. }
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment