Can you post the program's output, explain what is wrong with it and show what the output should be?

Also please post pseudo code (or a detailed description) for the algorithm that the code is...