myrdok123

Untitled

Feb 20th, 2023 (edited)
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1.  
  2. import java.util.Scanner;
  3.  
  4. public class Demo {
  5. public static void main(String[] args) {
  6. Scanner scanner = new Scanner(System.in);
  7.  
  8. int a = Integer.parseInt(scanner.nextLine());
  9. int b = Integer.parseInt(scanner.nextLine());
  10. int c = Integer.parseInt(scanner.nextLine());
  11.  
  12.  
  13.  
  14.  
  15. for (int num1 = 2; num1 <= a; num1 += 2) {
  16.  
  17. for (int num2 = 2; num2 <= b; num2++) {
  18.  
  19. boolean isPrime = num2 == 2 || num2 == 3 || num2 == 5 || num2 == 7;
  20.  
  21. for (int num3 = 2; num3 <= c; num3 += 2) {
  22.  
  23. if (isPrime) {
  24. System.out.printf("%d %d %d%n", num1, num2, num3);
  25. }else {
  26. break;
  27. }
  28. }
  29.  
  30. }
  31. }
  32. }
  33. }
  34.  
  35.  
  36.  
Advertisement
Add Comment
Please, Sign In to add comment