Код: Выделить всё
//Adding all the Elements in an array and displaying their sum
#include
using namespace std;
int main() {
int n;
cout > n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[n];
}
int sum;
for (int i = 0; i < n; i++) {
sum += a[n];
}
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78457933/sum-of-the-elements-present-in-an-array[/url]