Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- int firstStartNum, secondStartNum, firstEndNum, secondEndNum;
- cin >> firstStartNum >> secondStartNum >> firstEndNum >> secondEndNum;
- for (int i = firstStartNum; i <= firstStartNum + firstEndNum; i++) {
- for (int j = secondStartNum; j <= secondStartNum + secondEndNum; j++) {
- bool isFirstPrime = true;
- bool isSecondPrime = true;
- for (int k = 2; k <= sqrt(i); k++) {
- if (i % k == 0) {
- isFirstPrime = false;
- break;
- }
- }
- for (int k = 2; k <= sqrt(j); k++) {
- if (j % k == 0) {
- isSecondPrime = false;
- break;
- }
- }
- if (isFirstPrime && isSecondPrime) {
- cout << i << j << endl;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement