Deiancom

SecretDoor'sLock

Oct 24th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.10 KB | None | 0 0
  1. package ProgrammingBasics.NestedLoops;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class SecretDoorsLock08 {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int firstBorder = Integer.parseInt(scanner.nextLine());
  10.         int secondBorder = Integer.parseInt(scanner.nextLine());
  11.         int thirdBorder = Integer.parseInt(scanner.nextLine());
  12.  
  13.         for (int i = 1; i <= firstBorder; i++) {
  14.             for (int j = 1; j <= secondBorder; j++) {
  15.                 boolean isSimple = true;
  16.                 for (int l = 2; l <= j / 2; l++) {
  17.                     if (j % l == 0) {
  18.                         isSimple = false;
  19.                     }
  20.                 }
  21.                 for (int k = 0; k <= thirdBorder; k++) {
  22.                     boolean isEven = i % 2 == 0 && i != 0 && k % 2 == 0 && k != 0;
  23.                     if (isSimple && j != 1) {
  24.                         if (isEven) {
  25.                             System.out.printf("%s %s %s%n", i, j, k);
  26.                         }
  27.                     }
  28.                 }
  29.             }
  30.         }
  31.     }
  32. }
Add Comment
Please, Sign In to add comment