Advertisement
Macross36

LR3

Dec 7th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int array[5];
  7.     int sum = 0;
  8.     for (int x = 0; x < 5; x++)
  9.     {
  10.         cout << "x[" << x + 1 << "] = ";
  11.         cin >> array[x];
  12.         if (x % 2 == 0)
  13.             sum += array[x];
  14.     }
  15.     cout << "Suma elementiv masyvu z neparnymy nomeramy stanovyt " << sum;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement