You are viewing a single comment's thread. Return to all comments →
I dont know why there were a lot of code lines at first. My answer is simple like this and it works: C/C++
using namespace std; int main (){ int sum; int n; cin>>n; int ar[n]; for (int i=0;i>ar[i];
} for (int j=0;j<n;j++){ sum=sum+ar[j]; } cout<<sum; return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Simple Array Sum
You are viewing a single comment's thread. Return to all comments →
I dont know why there were a lot of code lines at first. My answer is simple like this and it works: C/C++
include
using namespace std; int main (){ int sum; int n; cin>>n; int ar[n]; for (int i=0;i>ar[i];
}