![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Feb 2005
Posts: 2
Rep Power: 0
![]() |
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. ![]() |
|
|
|
|
|
#2 |
|
The Supreme Ruler
![]() Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6
![]() |
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.
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower Last edited by Mjordan2nd; Feb 14th, 2005 at 6:47 AM. |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Feb 2005
Posts: 2
Rep Power: 0
![]() |
I need help in both questions 1 and 2. Without knowing what the maximum and the minimum is?
|
|
|
|
|
|
#4 |
|
Programming Guru
![]() |
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.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|