fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int main()
  6. {
  7. long long int n,a,sum=0;
  8. cin>>n;
  9. for(int i=0; i<n; i++)
  10. {
  11. cin>>a;
  12. sum+=a;
  13. }
  14. cout<<sum <<endl;
  15. }
Success #stdin #stdout 0.01s 5528KB
stdin
2
10 10
3
1 2 3
stdout
20