Please help me out here as the output is not correct
here is my code
#include
using namespace std;
void selection(int a[],int n)
{
for(int i=0;i<n-1;i++)
{
int min=a[i];
for(int j=i+1;j<n;j++)
{
if(a[j]<min)
{
int t;
t=a[j];
a[j]=min;
min=a[j];
}
}
}
for(int i=0;i<n;i++)
{
cout<<a[i]<<endl;
}
}
int main() {
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
selection(a,n);
return 0;
}