Solution for the Problem 6