+ 1
#include<iostream>
#include<cstdlib>
int cmp(const void * a, const void * b)
{ return ( *(int*)a > *(int*)b ); }
int main()
{
int n; std::cin>>n; int a[50];
for(int i=0;i<n;i++) std::cin>>a[i];
qsort(a,n,sizeof(int),cmp);
for (int i=0;i<n;i++) std::cout<<a[i]<<" ";
}
Aliter :
#include<algorithm>
#include<iostream>
int main()
{
int n; std::cin>>n; int a[50];
for(int i=0;i<n;i++) std::cin>>a[i];
std::sort(a.begin(),a.end());
for(int i=0;i<n;i++) std::cout<<a[i]<<" ";
}
//Or you may use any sorting algorithm of your choice in place of sort or qsort...