How to check if a number is divisible by 6? (1 Viewer)

hclifford

Registered User.
Local time
Yesterday, 23:53
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?
 

JHB

Have been here a while
Local time
Today, 08:53
Joined
Jun 17, 2012
Messages
7,732
Yes, the Mod function.
Code:
If YourInPut Mod 6 = 0 then
..
.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 07:53
Joined
Sep 12, 2006
Messages
15,692
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

Top Bottom