[AIZU Online Judge] List of Top 3 Hills [c]

Problem Link: List of Top 3 Hills

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0001

[c]
#include<stdio.h>
void bubble_sort(int m[]);
int m[10],i,j,temp;
int main()
{
for(i=0;i<10;i++){
scanf("%d",&m[i]);
}
bubble_sort(m);
return 0;
}

void bubble_sort(int m[])
{
for(j=0;j<10-1;j++){
for(i=0;i<10-j-1;i++){
if(m[i]<m[i+1]){
temp=m[i+1];
m[i+1]=m[i];
m[i]=temp;
}
}
}
for(i=0;i<3;i++){
printf("%dn",m[i]);
}
}

[/c]

Advertisements