hinagawa

14(ПП)

Sep 28th, 2020 (edited)
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. using namespace std;
  2. #include <iostream>
  3. #include <omp.h>
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     int sum = 0;
  9.     cout << "Enter n=";
  10.     cin >> n;
  11. #pragma omp for
  12.     for (int i = 1; i <= 2* n; i++)
  13.     {
  14.         if (i % 2 != 0)
  15.         {
  16.           sum+=i;
  17.         }
  18.        
  19.     }cout <<"Square="<< sum << endl;
  20.  
  21.  
  22. }
  23.  
Add Comment
Please, Sign In to add comment