C++,
pasted
on Aug 13:
|
#include<iostream.h>
int main()
{
int a[10] = {0,3,2,8,6,9,7,1,4,5};
for(int i=0; i<10; i++)
{
for(int j=i+1; j<10; j++)
{
if(a[i]<a[j])
{
int temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
cout<< a << endl;
return 0;
}
|
Output:
|
[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
|
|