Hello. I have this problem to collect 8 numbers from the user and find which one is the lowest and which is the highest. I tried to perform this task by using 16 if/else statements but the compiler complained, saying "statement label must be unique". Here is what i have now:
What is wrong with my code? also:
I was wondering if there was a way to loop through all 8 numbers to find the lowest and the highest without having to use 16 if/else statements.
Thank you in advance
Rich (BB code):
Input
Store Num1
Input
Store Num2
Input
Store Num3
Input
Store Num4
Input
Store Num5
Input
Store Num6
Input
Store Num7
Input
Store Num8
If, Load Num1
Subt Num2
Skipcond 800
Jump Else
Then, Load Num1
Store Lowest
Else, Load Num2
Store Lowest
If, Load Lowest
Subt Num3
Skipcond 800
Jump Else
Then, Load Lowest
Store Lowest
Else, Load Num3
Store Lowest
If, Load Lowest
Subt Num4
Skipcond 800
Jump Else
Then, Load Lowest
Store Lowest
Else, Load Num4
Store Lowest
If, Load Lowest
Subt Num5
Skipcond 800
Jump Else
Then, Load Lowest
Store Lowest
Else, Load Num5
Store Lowest
If, Load Lowest
Subt Num6
Skipcond 800
Jump Else
Then, Load Lowest
Store Lowest
Else, Load Num6
Store Lowest
If, Load Lowest
Subt Num7
Skipcond 800
Jump Else
Then, Load Lowest
Store Lowest
Else, Load Num7
Store Lowest
If, Load Lowest
Subt Num8
Skipcond 800
Jump Else
Then, Load Lowest
Store Lowest
Else, Load Num8
Store Lowest
If, Load Num1
Subt Num2
Skipcond 800
Jump Else
Then, Load Num2
Store Highest
Else, Load Num1
Store Highest
If, Load Highest
Subt Num3
Skipcond 800
Jump Else
Then, Load Num3
Store Highest
Else, Load Highest
Store Highest
If, Load Highest
Subt Num4
Skipcond 800
Jump Else
Then, Load Num4
Store Highest
Else, Load Highest
Store Highest
If, Load Highest
Subt Num5
Skipcond 800
Jump Else
Then, Load Num5
Store Highest
Else, Load Highest
Store Highest
If, Load Highest
Subt Num6
Skipcond 800
Jump Else
Then, Load Num6
Store Highest
Else, Load Highest
Store Highest
If, Load Highest
Subt Num7
Skipcond 800
Jump Else
Then, Load Num7
Store Highest
Else, Load Highest
Store Highest
Halt
If, Load Highest
Subt Num8
Skipcond 800
Jump Else
Then, Load Num8
Store Highest
Else, Load Highest
Store Highest
Load Lowest
Output
Load Highest
Output
Halt
Num1, Dec 0
Num2, Dec 0
Num3, Dec 0
Num4, Dec 0
Num5, Dec 0
Num6, Dec 0
Num7, Dec 0
Num8, Dec 0
Lowest, Dec 0
Highest, Dec 0
I was wondering if there was a way to loop through all 8 numbers to find the lowest and the highest without having to use 16 if/else statements.
Thank you in advance