prob6 output modified