#include #include #include #include bool is_prime(int num) { for (int i = 2; i < num; i++) { if (num % i == 0) { return false; } } return true; } int main(int argc, const char *argv[]) { int num_primes = 0; #pragma omp parallel for for (int i = 2; i < 1000; i++) { if (is_prime(i)) #pragma omp atomic num_primes++; } printf("Number of primes: %d\n", num_primes); return 0; }