dengxinyi 6 년 전
부모
커밋
238e4f33cd
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      easy/258.add-digits.go

+ 1 - 1
easy/258.add-digits.go

@@ -2,7 +2,7 @@ func addDigits(num int) int {
 	if num == 0 { // If sum of digits is divisable by 9, then num is divisable by 9.
 	// In fact, (num % 9) == [sum of digits] % 9
 		return 0
-	} else if n := nums % 9; n == 0 {
+	} else if n := num % 9; n == 0 {
 		return 9
 	} else {
 		return n