fork download
  1. #include <stdio.h>
  2. #include <omp.h>
  3.  
  4. int main() {
  5. int array1[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
  6. int array2[16] = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
  7. int result[16];
  8.  
  9. #pragma omp parallel for
  10. for (int i = 0; i < 16; i++) {
  11. result[i] = array1[i] + array2[i];
  12. }
  13.  
  14. // Serial display loop
  15. for (int i = 0; i < 16; i++) {
  16. printf("%d ", result[i]);
  17. }
  18.  
  19. printf("\n");
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0.01s 5292KB
stdin
Standard input is empty
stdout
17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17