My first program in C. It has been a learning process and I am actually quite confident with this language as a beginner. More to come.

/*
* File: ExchangeSort.c
* Author: Anthony Calandra
*
* Created on March 20, 2010, 5:22 PM
*/
#include <stdio.h>
#include <stdlib.h>
#define MAX_SIZE 10
/*
* Append an array of 10 random integers, sort them in order using
* the Exchange Sort algorithm
*/
main() {
int arr[MAX_SIZE], i, j;
printf("Creating array of 10 integers, appending random values: \n");
for (i=0; i < MAX_SIZE; i++) {
arr[i] = rand();
printf(" %d", arr[i]);
}
printf("\n\n");
printf("Sorting...\n");
for (i=0; i < MAX_SIZE; i++)
for (j=0; j < MAX_SIZE-1; j++) {
if (arr[j] > arr[i]) {
arr[i] ^= arr[j];
arr[j] ^= arr[i];
arr[i] ^= arr[j];
}
}
for (i=0; i < MAX_SIZE; i++)
printf(" %d ", arr[i]);
}If people want these algorithms in Java I have no problem converting.
Basically we take the numbers present in the array, and loop through these numbers (i), then we loop through them length-1 times (j) and if j happens to be bigger than i, we swap the values and continue all the way through the array until all nmbers are in order. The reason we loop length-1 times is because there is always 1 number that doesnt need to be counted since either way it will be sorted.