Critical Thinking

advertisement
Critical Thinking
Lesson 10
Numbers10
Extend the Numbers10 program you worked on in Step 10.5 to do additional
calculations. The program should also find the largest and smallest numbers
entered by the user. (Hint: Set the largest number variable equal to the
smallest possible integer, and set the smallest number variable equal to the
largest possible integer.)
Declare new variables. (intlargest, intsmallest, strsmallest,
strlargestdisplay, strsmallestdisplay)
Add below intcounter = 0
 intlargest = Int32.minvalue
 intsmallest = int32.maxvalue




Write two If statements comparing intnumber to intlargest
Write two statements to store results for intlargest and intsmallest
Write two statements to display results for largest # and smallest #

Write two statements to set visible property to true



Add the following comments within your program.
'Declare variable that will be used to find the largest and smallest
numbers entered 'by the user. Set the largest number variable equal to the
smallest possible integer 'and set the smallest number variable equal to
the largest possible integer.
'If the number that was just entered is larger than the value we have for
the largest number ... it is the new largest number
'If the number that was just entered is smaller than the value we have for
the smallest number ... it is the new smallest number
Test your program to make sure it works properly. When you have
accomplished the task – let me know so I can individually check it off. Print
the code and add to your binder for future reference.
Download