• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Easiest way to find highest number + how to see if one number is divisble by another

Status
Not open for further replies.
Level 2
Joined
Jan 19, 2011
Messages
19
I think GUI is easiest so:
For the first one, set a variable to the amount of numbers you got (the numbers should be in an array)
Set HighestNumber (Real Variable) = Numbers[1]
Loop - 1-AmountVar
If Numbers[IntegerA] is greater than HighestNumber then
set HighestNumber = Numbers[IntegerA]

And the second: Set both into a real variable (if you havent already), then do:
Set X (real) = (Number1/number2)
If X = (convert real (X) into integer) then
set CanBeDivided = true (or something)
Else do
set CanBeDivided = false (or something)

(Havent got Editor on this comp, so I cant test this right now)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
Your computer courses should have taught you these algerthims.

1. is the maximum, where you loop through all elements storing the largest element.
You can also do this by getting the first or last element if the array is sorted, but that is not always possible.

2. Check if the modulous in 0. Even GUI has an instriction for modulus. Basically it returns the remainder of a division opperation, so if the remainder is 0 then the number fully divides the other.
 
Status
Not open for further replies.
Top