View Code of Problem 75

#include <stdio.h>

int main(){
    int a[10],min,temp;
    int i,j,k;
    for (i=0; i<10; i++) {
        scanf("%d",&a[i]);
    }
    for(j=0;j<9;j++){
        min=j;
        for(k=j+1;k<10;k++)
            if(a[k]<a[min]) min=k;
        if(min!=j){
            temp = a[j];
            a[j] = a[min];
            a[min] = temp;
        }
    }
    
    for(int i=0;i<10;i++)
        printf("%d\n",a[i]);
    return 0;
}

Double click to view unformatted code.


Back to problem 75