Dimebagromero
Programmer
I have a string of code. I need to be able to enter a series of numbers, in no particular order, and then display the highest and lowest number. After a -99 is entered I need it to end the WHILE loop. What I have makes it loop, but when I enter the -99 it does not end the loop and display the bottom half of the code
CLS
' Declaration
numberEntered = 0
largestNumber = 0
smallestNumber = 999999
' Input the Weight of the Package
PRINT "Largest and Smallest"
PRINT
PRINT "Enter a series of numbers and displays the highest and lowest number."
PRINT "The numbers do not have to be entered in any special order."
PRINT "The number must be less than 1 million."
PRINT "Enter -99 to end the program."
PRINT
INPUT "Enter your first number "; numberEntered
'Execute the while loop until a -99 is entered as the number
DO
WHILE numberEntered <> -99
IF numberEntered > largestNumber THEN
largestNumber = numberEntered
IF numberEntered < smallestNumber THEN
smallestNumber = numberEntered
END IF
END IF
INPUT "Enter your next number "; numberEnterd
WEND
LOOP
'Display the largest and smallest numbers
PRINT
PRINT "You entered a series of numbers."
PRINT "The largest number is ; largestNumber"
PRINT "The smallest number is ; smallestNumber
CLS
' Declaration
numberEntered = 0
largestNumber = 0
smallestNumber = 999999
' Input the Weight of the Package
PRINT "Largest and Smallest"
PRINT "Enter a series of numbers and displays the highest and lowest number."
PRINT "The numbers do not have to be entered in any special order."
PRINT "The number must be less than 1 million."
PRINT "Enter -99 to end the program."
INPUT "Enter your first number "; numberEntered
'Execute the while loop until a -99 is entered as the number
DO
WHILE numberEntered <> -99
IF numberEntered > largestNumber THEN
largestNumber = numberEntered
IF numberEntered < smallestNumber THEN
smallestNumber = numberEntered
END IF
END IF
INPUT "Enter your next number "; numberEnterd
WEND
LOOP
'Display the largest and smallest numbers
PRINT "You entered a series of numbers."
PRINT "The largest number is ; largestNumber"
PRINT "The smallest number is ; smallestNumber