Contact: aviboots(AT)netvision.net.il
39,870 questions
51,793 answers
573 users
n = 38729 total_digit = Math.log10(n).to_i + 1 print total_digit # # run: # # 5 #
def num_digits(n) return Math.log10(n).to_i + 1 end n = 38729 puts num_digits(n) # # run: # # 5 #