Help with test cases

#include
using namespace std;
int main() {

int t,i,j,n;
cin>>t;
int csum=0;
int msum=0;
while(t--){
	cin>>n;
	int a[n];
	for(i=0;i<n;i++){
		cin>>a[i];
		
	}

	for(i=0;i<n;i++){
		csum+=a[i];
		if(csum<0){
			csum=0;
		}

		if (csum>msum){
			msum=csum;
		}
		
	}

cout<<msum;
}

return 0;

}

how to make while loop work

Take int csum=0;
int msum=0; within the while loop for test cases.
Try to correct it. If still your code does not work then save your code on ide.codingblocks.com and share its link.

i am not getting any link

Copy your code there. Then go to File->Save. After that copy the URL and paste it here.

Check now.