correct solution for C - 266 div2 - always proof your solution before coding