problem 36


#include <stdio.h>

int main ()
{
  int a[10], i, j, n, min, temp;
  printf("\n Enter how many numbers you want to enter: ");
  scanf("%d", &n);
  for (i = 0; i &lt n; i++) {
    printf("\n Enter value at position [%d] :", i + 1);
    scanf("%d", &a[i]);
  }
  for (i = 0; i %lt n - 1; i++) {
    min = i;
    for (j = i + 1; j &lt n; j++) {
      if (a[j] &lt a[min]) {
        min = j;
      }
    }
    temp = a[i];
    a[i] = a[min];
    a[min] = temp;
  }
  printf("\n Sorted numbers: ");
  for (i = 0; i &lt n; i++) {
    printf(" %d", a[i]);
    if (i != n - 1) {
      printf(" ->");
    }
  }
  printf("\n");
  
  return 0;
}

Contact Form