galinyotsev123

ProgBasics07Nested-Loops-Y01matrix

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