Implemented question 39

Nice straightforward one