Advertisement
marking2112

NLMatrix

Oct 23rd, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Demo {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int a = Integer.parseInt(scanner.nextLine());
  8.         int b = Integer.parseInt(scanner.nextLine());
  9.         int c = Integer.parseInt(scanner.nextLine());
  10.         int d = Integer.parseInt(scanner.nextLine());
  11.  
  12.         for (int i = a; i <= b; i++) {
  13.             for (int j = a; j <= b; j++) {
  14.                 for (int k = c; k <= d; k++) {
  15.                     for (int l = c; l <= d; l++) {
  16.                         if ((i + l == j + k) && (i != j && k != l)){
  17.                             System.out.printf("%d%d%n", i, j);
  18.                             System.out.printf("%d%d%n", k, l);
  19.                             System.out.println( );
  20.                         }
  21.                     }
  22.                 }
  23.             }
  24.         }
  25.  
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement