Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Assembly (http://www.programmingforums.org/forum20.html)
-   -   Help with some algorithm questions (http://www.programmingforums.org/showthread.php?t=2232)

mapster123 Feb 13th, 2005 9:03 PM

Help with some algorithm questions
 
Hello everyone,

I have two questions that need assistance with

1. Create an algorithm to input a series of positive and negative numbers (integers) and to display the highest and lowest values found. The input process is to end with an input of 999 and this value is not to be included in the calculations.

Eg. an input series of 6,100,-35,47,0,203,-16,999

would produce a display of Max 203 Min -35

2. Create an algorithm to accept a series of numbers whose values fall within range 1 to 5 inclusive. Input is to end when an input value of 999 is encountered - which is not to be included in the calculations. Any value outside the range of allowed values is to be ignored. :confused:

Mjordan2nd Feb 13th, 2005 9:08 PM

It doesn't sound too difficult. Which part exactly do you need help with? I would just use to addresses, one two hold max and one to hold minimum, and read the input. If the input is bigger than max, then set max to the input, and if the input is less than min, set min to the input.

mapster123 Feb 14th, 2005 3:41 AM

I need help in both questions 1 and 2. Without knowing what the maximum and the minimum is?

Berto Feb 14th, 2005 4:55 AM

he just gave you the answer, check input against current max and min if less then min make min = new input or if input > max dp the same.


All times are GMT -5. The time now is 4:25 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC