int i; double sum = 0.; /* allocating and initializing arrays */ /* ... */ #pragma omp parallel for default(shared) private(i) reduction(+:sum) for (i=0; i<N; i++) sum += a[i]*b[i]; }