Can you enter any number you want on an electronic calculator, no matter how large?

Answer:

No. Electronic calculators are limited to a certain maximum size of number.

Adding Up Numbers

QBasic is limited in the size of the number it can handle, just like calculators. The previous program will not really run forever because eventually the number in COUNT will get too large.

Here is a program from the last chapter. It asks the user for how many numbers are going to be added up. Then it uses a DO WHILE loop to ask for each number:

' First ask the user for how many numbers are going to be added.
' Then ask the user for each number, one by one.
' Add them up, print the sum.
'
PRINT "How many numbers are to be added"
INPUT HOWMANY
LET SUM = 0
LET COUNT = 1
'
DO WHILE COUNT <=  HOWMANY
  PRINT "Enter a number"       
  INPUT NUMBER                 
  LET SUM = SUM + NUMBER   
  LET COUNT = COUNT + 1
LOOP
PRINT "The sum is", SUM
END

The number that the the user types for HOWMANY will not be added to the SUM. Look at the following user dialogue:

How many numbers are to be added
? 3
Enter a number
? 10
Enter a number
?  5
Enter a number
?  2

QUESTION 11:

What will happen next?