ALL test cases showing wrong for bubble sort

#include
#include
using namespace std;

void Bubble_Sort(int *A,int n)
{
int i,j;
int flag=0;
for(i=0;i<n-1;i++)
{
for(j=0;j<n-1-i;j++)
{
if(A[j]>A[j+1])
{
swap(A[j],A[j+1]);
flag=1;
}
}
if(flag==0)
break;
}
for(i=0;i<n;i++)
cout<<A[i]<<endl;
}

int main() {

int t,n,i;
cin>>t;

while(t>0)
{
    cin>>n;
	int *A=new int[n];
    for(i=0;i<n;i++)
	   cin>>A[i];
	Bubble_Sort(A,n);
	t--;   
}

return 0;

}

hi @Mukul-Shane-1247687648773500
Why are u taking input of t… according to ques u have to take input n, then n elements… so remove ur while(t>0) loop ur should will work fine…

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.