Advertisement
Guest User

06.BarcodeGenerator

a guest
Dec 7th, 2022
482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. package PastExam18and19July2020;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class BarcodeGenerator_06 {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. int f = Integer.parseInt(scanner.nextLine());;
  10. int s = Integer.parseInt(scanner.nextLine());;
  11.  
  12. int f1 = f / 1000;
  13. int f2 = f/100 % 10;
  14. int f3 = f / 10 % 10;
  15. int f4 = f % 10;
  16.  
  17. int s1 = s / 1000;
  18. int s2 = s / 100 % 10;
  19. int s3 = s / 10 % 10;
  20. int s4 = s % 10;
  21.  
  22. for (int i = 1; i <= 9; i++)
  23. {
  24. for (int j = 1; j <= 9; j++)
  25. {
  26. for (int k = 1; k <= 9; k++)
  27. {
  28. for (int l = 1; l <= 9; l++)
  29. {
  30.  
  31. if((i%2!=0 || i==1)&&i>=f1&&i<=s1)
  32. {
  33. if ((j % 2 != 0 || j == 1) && j >= f2 && j <= s2)
  34.  
  35. {
  36. if ((k % 2 != 0 || k == 1) && k >= f3 && k <= s3)
  37.  
  38. {
  39. if ((l % 2 != 0 || l == 1) && l >= f4 && l <= s4)
  40.  
  41. System.out.printf("%d%d%d%d ",i,j,k,l);
  42.  
  43. }
  44.  
  45. }
  46.  
  47. }
  48.  
  49. }
  50. }
  51.  
  52. }
  53. }
  54.  
  55.  
  56.  
  57. }
  58. }
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement