Results 1 to 3 of 3
Hello, I am trying to:
Write a program that will allow a user to input as many numbers as the user wants ...and then find the sum, average, etc....of those ...
- 05-13-2008 #1Just Joined!
- Join Date
- May 2008
- Posts
- 4
reading an unlimited amount of numbers in script
Hello, I am trying to:
Write a program that will allow a user to input as many numbers as the user wants ...and then find the sum, average, etc....of those numbers...
the problem for me is how to write this..?? since it can be an unlimited amount of numbers the user enters, i dont think a simple read num, read num2, read num3....etc...would work...
- 05-17-2008 #2Linux Engineer
- Join Date
- Feb 2005
- Posts
- 1,044
Use a loop and add each number to a running total as it's input. Break out of the loop when no number in entered. Keep as many stats within the loop (number of entries made, etc) as you need to do the final processing.
- 05-17-2008 #3Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
It would also probably help to know the language that you will be using :P


Reply With Quote