Created
May 9, 2020 17:23
-
-
Save prakharshibu/8db2c7642af1a49066aa87aff9d4688c to your computer and use it in GitHub Desktop.
Simple array sum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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