Design the logic for a program that allows a user to enter any amount of numbers up to 10 or until a sentinal

value of -1 is entered.

Then the program displays the count of the numbers entered and numeric average of
the numbers (not including the -1 of course).

After display the average of all the entered numbers, the
program will then display each number and its difference from that average.

1 answer

x=0
i=0
sum=0
while x ≠ -1
read x
if x ≠ -1 { v[++i] = x; sum+=x }
end while

print i
if i==0 exit

avg = sum/i
print avg
for j=1..i print v[j],v[j]-i

you can add any labels you see fit for user interaction.