Final version of the code and output found.