You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
570 B

int a[5];
void sort()
{
int temp,max;
int i = 0;
int j = 0;
while(i < 4)
{
j = i+1;
max = i;
while(j<5)
{
if(a[max] < a[j])
max = j;
j = j + 1;
}
temp = a[i];
a[i] = a[max];
a[max] = temp;
i = i + 1;
}
}
int main()
{
int i = 0;
while(i < 5)
{
a[i] = getint();
i = i + 1;
}
sort();
i = 0;
while(i < 5)
{
putint(a[i]);
putch(32);
i = i + 1;
}
return 0;
}