while ... do
line that will keep it looping as long as
n≥0?
while ... do
line that will keep the while
loop running as long as n≥0.
n=0
sum=0
count=0
while ???? do
print("type a number (< 0 to exit): ")
n = tonumber(input())
if n >=0 then
sum=sum+n
count=count+1
end
end
print("The average is",sum/count)
while
loop to cause it to have a true
condition as long as the text in variable n is ≥0? Note: the tonumber()
function around
the input()
function it to ensure the information read from the keyboard will be an actual
number (not a string).