Where did you define x and please explain what you want to do more clearly. Your loop will work from 0 to 10 including 9. Here you will square your x value as long as it is less than 5, otherwise you will increase it by one but I don't see your x value changing in the loop. You are just increasing the loop number by increasing it well. I don't understand what kind of result you want