Draft

Digit Sum

60 of 207user3028132

Description:

your task is to implement a method/function that takes a posistive integer and returns its single digit sum of digits **i.e. keep summing the digits till only one digit remains.

Examples: //for Java
sumDigits(4523) = 4 + 5 + 2 +3 = 14 = 1 + 4 = 5
here sumDgits(4523) should return 5
sumDigits(65536) = 6 + 5 + 5 + 3 + 6 = 25 = 2 + 5 = 7
here sumDgits(65536) should return 7

Examples: //for Ruby and Python
sum_digits(4523) = 4 + 5 + 2 +3 = 14 = 1 + 4 = 5
here sum_digits(4523) should return 5
sum_digits(65536) = 6 + 5 + 5 + 3 + 6 = 25 = 2 + 5 = 7
here sum_digits(65536) should return 7

Mathematics

More By Author:

Check out these other kata created by user3028132

Stats:

CreatedOct 21, 2015
Warriors Trained343
Total Skips7
Total Code Submissions727
Total Times Completed207
Java Completions60
Python Completions120
Ruby Completions44
Total Stars8
% of votes with a positive feedback rating88% of 120
Total "Very Satisfied" Votes101
Total "Somewhat Satisfied" Votes10
Total "Not Satisfied" Votes9
Total Rank Assessments130
Average Assessed Rank
6 kyu
Highest Assessed Rank
1 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • user3028132 Avatar
Ad