Answer to Question #284850 in Python for PRR

Question #284850

Find the number of digits between 1 to N

example:

  1. I/P = 10 O/P=11
  2. I/P=4 O/P=4
  3. I/P = 13 O/P=17
  4. I/P=111 O/P=225

and so on...


1
Expert's answer
2022-01-05T01:40:35-0500

def findDigits(N):

    if N == 1:
      return 1
# changing number to string 
s = str(N)
# Add length of number to total return len(s) + findDigits(N -
# Driver code 
# Given N
N = 13
# Function call
print (findDigits(N))
Output: 17






Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS