hey guys, need some help with this project i have made.

Static temp(7) As Integer
Dim total As Integer
Dim I As Integer
Dim average As Single

'Initialize
Randomize()

'Temperature Generator
For I = 1 To 7

temp(I) = Int(Rnd(1) * 38 + 1)
Next I

For I = 1 To 7
Debug.WriteLine(temp(I))
Next I

Debug.WriteLine("****************")

'get average
total = 0
For I = 1 To 7
total = temp(I) + total

Next I

'output
average = (total / 7)
Debug.WriteLine(average)

That code makes a program that random generates 7 numbers and makes an average of them in the immediate window( is working ). How would i be able to get the minimum(lowest) and maximum(highest) number from the 7 numbers and output the two numbers to preferably a textbox or immediate window.

If anyone could help would be great, thankyou

Recommended Answers

All 3 Replies

If you really wrote that program then it should not be all that difficult for you to complete the assignment. Just add two more variables to hold the highest and lowest values. If however you did not write that code, then you are committing plagiarism (claiming something is your work when you know it isn't).

I did write this code myself, im fairly new to visual basic.net, i was just asking for help no need to be rude. Obviously a mistake to ask for help here, problem solved.

I really was not trying to be rude -- I apologize if you took it that way. Since you write that much, like I said you know enough about programming to be able to add two more variables and figure out how to determine the highest and lowest variables -- just think about it a bit. When you enter a number, test it against the highest value -- if the new number is greater then set the high-counter equal to the current number. Same algorithm for keeping track of the lowest number.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.