it is showing a run error when I am submitting the code. pls help
here is the code :-
#include
using namespace std;
int main() {
int t,n,a[1000];
int i,j,k;
int sum=0,max;
cin>>t;
while(t–)
{
cin>>n;
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(i=0;i<n;i++)
{
for(j=0;j<=i;j++)
{
for(k=j;k<=i;k++)
{
sum=sum+a[k];
}
if(i==0)
{
max=sum;
}
if(sum>max)
{
max=sum;
}
sum=0;
}
}
cout<<max<<endl;
}
return 0;
}