Public Group

# Finding multiples of a set number =)

This topic is 4213 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Just wondering, is there a super efficient way to find multiples of a number? If I have incorectly asked my question, I mean, suppose one day, people's heads will suddenly explode for no reason. There is a line of 36 people, and 360 miles of land. And some guy controling physics of the world is programming the "earth's computer" so that every 10 miles the line of people walk, one person will go boom. How would he do this? Ooh, sorry =) : Also I dont understand the allegro doc or chm, so I cant look for this answer: Does set_color_depth(16); mean I can only use 16 bit bitmaps? My games look badly discolored

##### Share on other sites
Choose a number n (for instance, 10).

Multiply this number by an integer, m (for instance, 2).

The result (here, 20) is a multiple of n.

##### Share on other sites
Choose a number N (say 100)
Choose to find if it is a multiple of M (10 for instance)
The result is remainder 100/10 == 0 determined easily in C++ with modulus
100 % 10 == 0
or with floating point numbers
fmod ( 100, 10 ) == 0

Any non-multiple will result in a non-zero remainder.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 13
• 12
• 15
• 11
• 12
• ### Forum Statistics

• Total Topics
634153
• Total Posts
3015844
×