created and solved Problem 6
normal adjustments to main for displaying solution