➽ Problem:-
https://www.hackerrank.com/challenges/simple-array-sum/problem
➽ Solution:-
#include<bits/stdc++.h>
using
namespace std;
int main()
{
int N;
cin>>N;
vector<int> A(N);
int sum=0;
for(int i=0;i<N;i++)
{
cin>>A[i];
}
for(int i=0;i<N;i++)
{
sum += A[i];
}
cout<<sum<<endl;
return 0;
}
0 Comments
Please do not enter any spam link in the comment section.