#include <omp.h> #include <stdio.h> #include <stdlib.h> int main (int argc, char *argv[]) { int n_threads, thread_id; #pragma omp parallel private(n_threads, thread_id) { thread_id = omp_get_thread_num(); printf("Hello World from thread %d\n", thread_id); if (thread_id == 0) { n_threads = omp_get_num_threads(); printf("Number of threads is %d\n", n_threads); } } n_threads = omp_get_num_threads(); printf("Number of threads is %d\n", n_threads); }