Skip to content

Commit cd289b1

Browse files
EASY/src/easy/AddDigits.java
1 parent 3b456d5 commit cd289b1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

EASY/src/easy/AddDigits.java

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package easy;
2+
3+
public class AddDigits {
4+
//only three cases as the code shows
5+
public int addDigits(int num) {
6+
if(num == 0) return 0;
7+
if(num % 9 == 0) return 9;
8+
return num%9;
9+
}
10+
11+
}

0 commit comments

Comments
 (0)