Advertisement
psi_mmobile

Untitled

May 28th, 2022
853
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.14 KB | None | 0 0
  1. public class MyClass {
  2.     public static void main(String args[]) {
  3.         java.util.Scanner scanner = new java.util.Scanner(System.in);
  4.         int beginningInt = Integer.parseInt(scanner.nextLine());
  5.         int endingInt = Integer.parseInt(scanner.nextLine());
  6.         String beginning = String.valueOf(beginningInt);
  7.         String ending = String.valueOf(endingInt);
  8.         for (int j = Character.getNumericValue(beginning.charAt(0)); j <= Character.getNumericValue(ending.charAt(0)); j++) {
  9.             for (int k = Character.getNumericValue(beginning.charAt(1)); k <= Character.getNumericValue(ending.charAt(1)); k++) {
  10.                 for (int l = Character.getNumericValue(beginning.charAt(2)); l <= Character.getNumericValue(ending.charAt(2)); l++) {
  11.                     for (int m = Character.getNumericValue(beginning.charAt(3)) ; m <= Character.getNumericValue(ending.charAt(3)); m++) {
  12.                         if (j % 2 != 0 && k % 2 != 0 && l % 2 != 0 && m % 2 != 0) {
  13.                             System.out.printf("%d%d%d%d ",j,k,l,m);
  14.                         }
  15.                     }
  16.                 }
  17.             }
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement