In this HackerEarth Array Sum problem solution, You are given an array A consisting of N integers.
HackerEarth Array Sum problem solution.
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int ll;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
ll n,sum=0;
cin>>n;
while(n--)
{
ll a;
cin>>a;
sum+=a;
}
cout<<sum;
return 0;
}
0 Comments