Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 13 lines (9 sloc) 277 Bytes
#!/usr/bin/ruby
# http://www.reddit.com/r/dailyprogrammer/comments/1berjh/040113_challenge_122_easy_sum_them_digits/
# Returns the digital route of the given number
def getDigitalRoute( n )
n - 9 * ( (n - 1) / 9 ).floor
end
ARGV.each do|a|
p getDigitalRoute(a.to_i)
end
Something went wrong with that request. Please try again.