View Code of Problem 75

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

Double click to view unformatted code.


Back to problem 75