Problem in sort stl

i am using sort of an int array and then using for loop to print that int array but it is not working;

long long n,k,;
cin>>n>>k;
long long a[n];
for(int j=0;j<n;j++){
cin>>a[i];
}
sort(a,a+n);
for(int j=n-1;j<=0;j–){
cout<<a[j]<<"\n";}//this cout is not show anything

j<=0

This is unlikely to be true initially (unless n is read in as 0 or 1), so the for loop body never executes.

Edit:

Also, what’s i, here?

for(int j=0;j<n;j++)
{
   cin>>a[i];
}

for(int j=n-1;j<=0;j–){
cout<<a[j]<<"\n";}//this cout is not show anything

The condition in for loop should be j>=0.

You are iterating from last index to first index after sorting so the for loop containing cout statement should be like :for (j = n-1; j >= 0; j--)

for(int j=0;j<n;j++){
cin>>a[i];
}

cin >> a[i] ?? It should be a[j]

for(int j=n-1;j<=0;j–)
j<=0 ? Make it j>=0 (j is never negative here)

thanks for help