#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int sum = 0; for(int i = 1;i <= n;i++) { int x; cin >> x; sum += x; //把每一個輸入的數字x都加起來 } cout << sum; return 0; }
#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int sum = 0; for(int i = 1;i <= n;i++) { int x; cin >> x; sum += x; //把每一個輸入的數字x都加起來 } cout << sum; return 0; }