Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using namespace std;
- #include <iostream>
- #include <omp.h>
- int main()
- {
- int n;
- int sum = 0;
- cout << "Enter n=";
- cin >> n;
- #pragma omp for
- for (int i = 1; i <= 2* n; i++)
- {
- if (i % 2 != 0)
- {
- sum+=i;
- }
- }cout <<"Square="<< sum << endl;
- }
Add Comment
Please, Sign In to add comment