Think aboutr it. Your getting the user to input a number, then your saying

start the loop at 1
loop until the entered number reaches 10
sum = sum + 1

That will give you
0+1
1+1
2+1
3+1
4+1

you need to be using the sum to add with and looping until the sum is reached.