Maximum circular sum problem 1

pls tell the problem in this code , it is working correct on ide but showing wrong ans

#include
#include
using namespace std;
int main() {
int t;
cin>>t;
int i,j,k;
for(i=0;i<t;i++)
{
int n;
cin>>n;
int a[n];
for(j=0;j<n;j++)
cin>>a[j];
int asum=0;
for(j=0;j<n;j++)
asum=asum+a[j];
int min_ending_here=0;
int min_so_far=0;
for(j=0;j<n-1;j++){
if(min_ending_here>0)
min_ending_here=a[j];
else min_ending_here+=a[j];
min_so_far=min(min_so_far,min_ending_here);
}
cout<<asum-min_so_far;
}
return 0;

}

Hey Pritika, your output should exactly match the output format, so you are supposed to print the output for each test case in new line. To correct this modify your printing statement as cout<<asum-min_so_far<<endl; in line: 25.