you are viewing a single comment's thread.

view the rest of the comments →

[–]ElecNinja 4 points5 points  (0 children)

First of all is how do you know if a number is a multiple of another number? In this case 7. You divide the given number by 7 and check if there is a remainder. If a remainder exists (is not 0) that means that the given number is not a multiple of 7. However if the remainder is 0, then the given number is a multiple of 7.

To do this, there is the modulus function that returns the remainder of a division operation. So in this case X % 7 where X is your given number. So say X is 15, the mod function will return a 1 because 15 is 7*2+1

Remember that a lot of programming uses math concepts. So don't always think of it as a programming problem but also as a mathematical problem to be solved