After putting the array elements into random order and printing, sort the array and then print again.
You can write your own sort routine, use the one from the book (section 5.6), or use qsort() from stdlib.h