galinyotsev123

ProgBasics07Nested-Loops-MoreExercises-Y01SecretDoorsLock

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