28 lines
555 B
C
28 lines
555 B
C
#include <stdio.h>
|
|
#include <stdbool.h>
|
|
#include <math.h>
|
|
|
|
bool isPrime(int toBeTested){
|
|
int iterationMax = 0, nowCheck = 2;
|
|
bool isPrime = true;
|
|
iterationMax = sqrt(toBeTested);
|
|
do {
|
|
if (toBeTested % nowCheck == 0) {
|
|
isPrime = false;
|
|
break;
|
|
}
|
|
nowCheck++;
|
|
}
|
|
while (nowCheck <= iterationMax);
|
|
return isPrime;
|
|
}
|
|
|
|
int main() {
|
|
int j;
|
|
for (j = 11; j < 198; j+2) {
|
|
if(isPrime(j) && isPrime(j+2)) {
|
|
printf("%d %d\n", j, j+2);
|
|
}
|
|
}
|
|
return 0;
|
|
} |