Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Need help displaying the lowest of 5 numbers to the screen
Author Message
Miko99

Posted: Thu Mar 27, 2003 11:01 am   Post subject: 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.
Sponsor
Sponsor

Blade

Posted: Thu Mar 27, 2003 11:39 am   Post subject: (No subject)

first you would set a high and low variable
 code: 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
 code: if(num > high)then high:=num

you do the same for the low... so
 code: if(num < low)then low:=num end if

then you put it in a loop to do it to every number...
Miko99

Posted: Thu Mar 27, 2003 6:36 pm   Post subject: (No subject)

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

Posted: Thu Mar 27, 2003 7:08 pm   Post subject: (No subject)

lol yea, i'm taking grade 10 turing too... just started this semester ... no problem.. i'll help if i can
Miko99

Posted: Fri Mar 28, 2003 8:47 am   Post subject: (No subject)

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

Posted: Fri Mar 28, 2003 10:25 am   Post subject: (No subject)

How do i put both numbers a high and a low to the screen now?
Blade

Posted: Fri Mar 28, 2003 11:38 am   Post subject: (No subject)

Delta wrote:
 code: 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..
 code: 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

Posted: Fri Mar 28, 2003 12:09 pm   Post subject: (No subject)

for info on loops you can read this tutoral we have:

http://www.compsci.ca/bbs/viewtopic.php?t=370
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Sponsor
Sponsor

 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 8 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: