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