Skip to content

Commit 933d239

Browse files
author
Ram swaroop
committed
old school method added to multiple of 3
1 parent b59c9c4 commit 933d239

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/me/ramswaroop/bits/MultipleOf3.java

+9
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,12 @@ public static void main(String a[]) {
4949
System.out.println(isMultipleOf3(-17));
5050
}
5151
}
52+
53+
/**
54+
* Old School Method:
55+
*
56+
* If sum of digits in a number is multiple of 3 then number is multiple of
57+
* 3 e.g., for 612 sum of digits is 9 so it’s a multiple of 3. But this solution
58+
* is not efficient. You have to get all decimal digits one by one, add them and then check if sum is multiple of 3.
59+
*
60+
*/

0 commit comments

Comments
 (0)