Finding the Smallest or Biggest Numbers?

Finding the Smallest or Biggest Numbers?

Anonymous
Not applicable
159 Views
2 Replies
Message 1 of 3

Finding the Smallest or Biggest Numbers?

Anonymous
Not applicable
I have 5 numbers and would like to find the biggest or smallest number out
of all 5. Is there a easy way to do this? Thanks for the help in advanced.

Bryan
0 Likes
160 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Set largest and smallest equal to the first item, then test the rest:

smallest=list(0)
largest=list(0)
for i=1 to UBOUND(list)
if list(i)
smallest=list(i)
endif
if list(i)>largest then
largest=list(i)
endif
next

Bud

"Bryan" wrote in message
news:2A938758161754C69B8519453C14D02D@in.WebX.SaUCah8kaAW...
> I have 5 numbers and would like to find the biggest or smallest number out
> of all 5. Is there a easy way to do this? Thanks for the help in advanced.
>
> Bryan
>
0 Likes
Message 3 of 3

Anonymous
Not applicable
Hmmmm....

let's say N(0 to 4) is the array with the numbers...

Max=N(0)
for i=0 to 4
if N(i) > Max then Max=N(i)
next i

Now that wasn't a mindbender, was it? 😃

wkr, jwk

--
You ask a silly question, you get a technical answer...

Bryan had the next bright idea:

>I have 5 numbers and would like to find the biggest or smallest number out
>of all 5. Is there a easy way to do this? Thanks for the help in advanced.
>
>Bryan
>
>
0 Likes