
-----------------------------------
cutiegirl_14_16
Thu Mar 06, 2003 8:25 pm

example problem??? I'm totally lost!
-----------------------------------
ok so here's the program
assuming that the variables are already declared

loop
put "Enter a number. To end the program type stop"
exit when number=-999
count:=count+1
end loop
put "The number of number's entered is", count


How do u change the program to read the series of numbers and determine the total sum of the numbers entered.

help would be great!!!!!!!

-----------------------------------
Tony
Thu Mar 06, 2003 8:30 pm


-----------------------------------
same thing, but instead of counting how many number were entered (+1 through each run) you add up the total (current total + number entered)

so

loop 
put "Enter a number. To end the program enter -1"
get number
exit when number=-1 
total := total + number
end loop 

put "the total is: ", total


it should be -1 instead of "stop" because that way you'd have to get input as string and convert it to integer with strint() and its extra work... so just -1 or 0 or w/e other number you dont think user would use.

-----------------------------------
cutiegirl_14_16
Thu Mar 06, 2003 8:35 pm


-----------------------------------
thanx...ur a life saver....twice!

-----------------------------------
Tony
Thu Mar 06, 2003 8:36 pm


-----------------------------------
:D no problem, thats what this site is for :wink:
