SHARE
TWEET

Untitled

a guest Oct 21st, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5.  
  6.   int main() {
  7.  
  8.       int N;
  9.       cin >> N;
  10.       int *p = new int[N];
  11.       for (int i = 0; i < N; i++)
  12.       // цикл, с помощью которого загоняем элементы в массив
  13.       {
  14.           cin >> p[i];
  15.       }
  16.           int rez=0;
  17.           for ( int k = N; k > 0; k--)
  18.           {
  19.               if (p[k] < 0)
  20.               {
  21.                   break;
  22.               }
  23.               rez = rez + p[k];
  24.            
  25.           }
  26.     cout << "summ = " << rez << endl;
  27.      
  28.      
  29.       delete [] p;
  30.  }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top