Skip to content

Instantly share code, notes, and snippets.

@bky373
Created September 7, 2020 16:47
Show Gist options
  • Save bky373/3b3ef80a5060f621826cf10b6088d4fc to your computer and use it in GitHub Desktop.
Save bky373/3b3ef80a5060f621826cf10b6088d4fc to your computer and use it in GitHub Desktop.
class Solution {
fun solution(n: Int): Int {
var sum = 0
var number = n
while(number%10 != 0 || number > 0){
sum += number%10
number = number/10
}
return sum
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment