Those kind of loops are well implemented by a do-while loop: you should write your code following this logic (you didn't specify any particular language, so I'll just write down the logic in pseudo code):
sum=0;
do {
num = prompt(number);
if(number>0) {
sum = sum+number;
}
while (number>0);
print(sum);
So, what we're doing is: