Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "Rus");
- int N;
- int Sum = 0;
- cout << "Введите число элементов " << endl;
- cin >> N;
- vector<int> a(N);
- cout << "Введите элементы массива ." << endl;
- for (int i = 0; i < N; i++)
- {
- cin >> a[i];
- }
- for (int sum :a)
- {
- Sum += sum;
- }
- cout << "Сумма элементов массива равна = " << Sum;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement