Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using namespace std;
- #include <iostream>
- #include <omp.h>
- int main()
- {
- int a[30] = { 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1 };
- int sum = 0;
- #pragma omp parallel shared(a)
- {
- #pragma omp for
- for (int i = 0; i < 30; i++)
- {
- sum += a[i] * (30 - i);
- }
- }
- cout << "The number is:" << sum << endl;
- }
Add Comment
Please, Sign In to add comment