Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package NestedLoopsMoreEx;
- import java.util.Scanner;
- public class PrimePairs {
- public static void main(String[] args) {
- Scanner scanner = new Scanner (System.in);
- int firstCouple = Integer.parseInt ( scanner.nextLine () );
- int secondCouple = Integer.parseInt ( scanner.nextLine () );
- int firstEnd = Integer.parseInt ( scanner.nextLine () );
- int secondEnd = Integer.parseInt ( scanner.nextLine () );
- for (int a = firstCouple; a <= firstCouple + firstEnd; a++){
- for (int b = secondCouple; b <= secondCouple + secondEnd; b++){
- if (a % 2 != 0 && a % 3 != 0 && a % 5 != 0 && a % 7 != 0 && b % 2 != 0 && b % 3 != 0&& b % 5 != 0&& b % 7 != 0) {
- System.out.printf ( "%d%d%n", a, b );
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement