Skip to content

Commit 4f9754e

Browse files
committed
Update Solution.java
1 parent ff3cb78 commit 4f9754e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/g3001_3100/s3099_harshad_number/Solution.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public int sumOfTheDigitsOfHarshadNumber(int x) {
1212
sum = sum + digit;
1313
temp = temp / 10;
1414
}
15-
if (x % sum == 0) {
15+
if (sum !=0 && x % sum == 0) {
1616
return sum;
1717
}
1818
return -1;

0 commit comments

Comments
 (0)