View Code of Problem 75

#include <stdio.h>
main(){
	int a[10],i,j,t,m;
	for(i = 0;i<10;i++)
		scanf("%d",&a[i]);
	for(i = 0;i<10;i++){
		t = a[i];m = i;
		for(j = i;j<10;j++){
			if(t>a[j]){
				t = a[j];
				m = j;
			}
		}
		if(m !=i){
			a[m] = a[i];
			a[i] = t;
		}
	}
	for(i = 0;i<10;i++)
		printf("%d\n",a[i]);
	return 0;
}

Double click to view unformatted code.


Back to problem 75