Just create an array of type int and loop through each of your 10000 cases storing the result in the location that sum has (2 - 12). Pseudo code below:
Code:
int results[13] = { 0 }, sum = 0, index; //12 is the highest possible sum
for(index = 0; index <= 10000; index++){ //for each of the 10,000 iterations
sum = getSum();
results[sum]++;
}
That's how I would go about doing it.
Then to read this info back to stdout, you could just loop through your array like so:
Code:
for( index = 0; index <= 12; index++ )
printf("There were %d %d's\n", result[index], index );