数组
N个数之和
http://www.nowcoder.com/questionTerminal/b007744eb43b4f7b95d9e87de01528db
#include<bits/stdc++.h>
using namespace std;
int a[45];
int main()
{
int n, s = 0;
cin >> n;
for(int i = 1; i <= n; i++)
{
cin >> a[i];
}
for(int i = 1; i <= n; i++)
{
s += a[i];
}
cout << s << endl;
return 0;
}
using namespace std;
int a[45];
int main()
{
int n, s = 0;
cin >> n;
for(int i = 1; i <= n; i++)
{
cin >> a[i];
}
for(int i = 1; i <= n; i++)
{
s += a[i];
}
cout << s << endl;
return 0;
}