
-----------------------------------
Miko99
Thu Mar 27, 2003 11:01 am

Need help displaying the lowest of 5 numbers to the screen
-----------------------------------
When the user enters in 5 numbers, hwo do i get it to display the lowest and highest to the screen. I have to write 3 programs. 1 to display the lowest, 1 to display the highest and 1 to display both. Thanks for the help guys.

-----------------------------------
Blade
Thu Mar 27, 2003 11:39 am


-----------------------------------
first you would set a high and low variable

var high:int:=-9999
var low:int:=9999

you use it like that because you are comparing the high to the numbers they have entered... so thats what you do next
if(num > high)then
high:=num

you do the same for the low... so
if(num < low)then
low:=num
end if

then you put it in a loop to do it to every number...

-----------------------------------
Miko99
Thu Mar 27, 2003 6:36 pm


-----------------------------------
Thanks man your the coolest. I am taking a grade 10 turing class even tho im in grade 12. test tommorow so i may be on in the morning requesting help lol.

-----------------------------------
Blade
Thu Mar 27, 2003 7:08 pm


-----------------------------------
lol yea, i'm taking grade 10 turing too... just started this semester :-D... no problem.. i'll help if i can

-----------------------------------
Miko99
Fri Mar 28, 2003 8:47 am


-----------------------------------
How do i do a loop in turring? i know how to in Java, and C++ but not in turring!! help me! its a for loop.

-----------------------------------
Miko99
Fri Mar 28, 2003 10:25 am


-----------------------------------
How do i put both numbers a high and a low to the screen now?

-----------------------------------
Blade
Fri Mar 28, 2003 11:38 am


-----------------------------------

var low:int:=9999 
var num:int 

for i : 1.. 6
    put "Enter in a number" 
    get num 
    if (num < low)then 
        low := num 
    end if 
    cls 
end for
put "The Lowest number is: ",low


delta wrote this for you in one of your other posts... you would just add in the high as well... so..

var low:int:=9999
var high:int:=-9999
var num:int 

for i : 1.. 6
    put "Enter in a number" 
    get num 
    if (num < low)then 
        low := num 
    eslif(num>high)then
        high:=num
    end if 
    cls 
end for
put "The Lowest number is: ",low
put "The highest number is: ",high


-----------------------------------
Dan
Fri Mar 28, 2003 12:09 pm


-----------------------------------
for info on loops you can read this tutoral we have:

http://www.compsci.ca/bbs/viewtopic.php?t=370
