fork download
  1. #include <omp.h>
  2. #include <iostream>
  3. using namespace std;
  4. int main(){
  5. int total_sum, partial_sum;
  6. #pragma omp paralle private (partial_sum) shared (total_sum)
  7. {
  8. total_sum = 0;
  9. partial_sum = 0;
  10. #pragma omp for
  11. {
  12. for (int i = 1; i <= 1000; i++){
  13. total_sum += i;
  14. }
  15. }
  16. }
  17.  
  18. cout << total_sum;
  19. }
  20.  
  21.  
Success #stdin #stdout 0.01s 5472KB
stdin
Standard input is empty
stdout
500500