Solution for problem 13 (easy)