Simple Array Sum

  • + 0 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];

    }
    for (int j=0;j<n;j++){
        sum=sum+ar[j];
    }
    cout<<sum;
    return 0;
    

    }