Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using std::cout;
- using std::cin;
- using std::endl;
- int main()
- {
- int n;
- cout << "Введите количество элементов массива : ";
- cin >> n ;
- int a[n];int l;int b;
- // Заполняем массив с клавиатуры
- for (int i = 0; i < n; i++) {
- cout << "[" << i + 1 << "]" << ": ";
- cin >> a[i];
- }
- cout << "\Сумма элементов массива: ";
- for (int i = 0; i < n; ++i) {
- l=a[i]+l;
- }
- cout<<l<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement