You don't want to add the count to the result....... Doing so changes the value of the result. What you meant to do is "number = number + counter".. But if you did that, you would get the squares...