How to check if a number is divisible by 6?

hclifford

Registered User.
Local time
Today, 05:39
Joined
Nov 19, 2014
Messages
30
Hi all,

As per the title, is there a function that will let me check if a value that was input is divisible by 6?
 
Yes, the Mod function.
Code:
If YourInPut Mod 6 = 0 then
..
.
 
clearly mod is the way to go in computing terms.


however, mathematical speaking a number is divisible by 3 if the sum of its digits is also divisible by 3. eg 128954 sums to 29, which sums to 11, which sums to 2 - so not divisible by 3

a number is divisible by 9 if the sum of its digits are also divisible by 9

a number is divisible by 6 if it is divisible by 3, as above, and is even.
 

Users who are viewing this thread

Back
Top Bottom