Given
N = 10From 1 to 9, each number contains a single digit. From 10 onwards, the numbers contain two digits.
So the output should be 9 + 2 =
11.
Sample Input 1
10
Sample Output 1
11
Sample Input 2
4
Sample Output
4
n = int(input('Enter n here: '))
n1 = 0
for i in range(1, n+1):
n1 = n1 + len(str(i))
print(n1)
Enter n here: 10
11
Enter n here: 4
4
Comments
Leave a comment