Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 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 n = Integer.parseInt(scanner.nextLine());
  8. int m = Integer.parseInt(scanner.nextLine());
  9. int l = Integer.parseInt(scanner.nextLine());
  10.  
  11. for (int i = 1; i <= n; i++) {
  12. if (i % 2 == 0) {
  13. for (int j = 1; j <= m; j++) {
  14.  
  15. int counter = 0;
  16.  
  17. for (int p = 2; p <= j / 2; p++) {
  18.  
  19. if (j % p == 0) {
  20. counter++;
  21. }
  22. }
  23.  
  24. if (counter == 0&&j!=1) {
  25.  
  26. for (int k = 1; k <= l; k++) {
  27. if (k % 2 == 0) {
  28. System.out.printf("%d %d %d%n", i, j, k);
  29. }
  30.  
  31. }
  32. }
  33.  
  34. }
  35. }
  36. }
  37.  
  38.  
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement