#include <iostream.h>
void main()
{
int max, temp;
int num[10];//={6,32,59,4,1,332,66,5,9,10};
for ( int k=0 ; k < 10 ; k++ )
cin >> num[k];
for ( int i=0 ; i < 9 ; i++ )
{
max=0;
for ( int j = 1 ; j < 10-i ; j++ )
{
if ( num[j] > num[max] )
{
max = j;
}
}
temp = num[9-i];
num[9-i] = num[max];
num[max] = temp;
}
for (i=0 ; i<10 ; i++ )
cout << num[i] << " ";
}
No comments:
Post a Comment