Skip to content

Instantly share code, notes, and snippets.

@prakharshibu
Created May 9, 2020 17:23
Show Gist options
  • Save prakharshibu/8db2c7642af1a49066aa87aff9d4688c to your computer and use it in GitHub Desktop.
Save prakharshibu/8db2c7642af1a49066aa87aff9d4688c to your computer and use it in GitHub Desktop.
Simple array sum
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,sum=0;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
for(int i=0;i<n;i++)
{
sum=sum+a[i];
}
cout<<sum<<endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment