Polnochniy

Untitled

Nov 13th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. setlocale(LC_ALL, "Rus");
  6. int N;
  7. cout << "Введите число элементов " << endl;
  8. cin >> N;
  9. int* a = new int[N];
  10. int Sum = 0;
  11. cout << "Введите элементы массива ." << endl;
  12. for (int i = 0; i < N; i++)
  13. {
  14. cin >> a[i];
  15. Sum += a[i];
  16. }
  17. cout << "Сумма элементов массива равна = " << Sum;
  18. delete[] a;
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment