Problem Description
Write a program to count the number of digits.
Refer sample input and output for formatting specification.
All float values are displayed correct to 2 decimal places.
All text in bold corresponds to input and the rest corresponds to outputCODING ARENA
n=int(input())
count=0
while(n>0):
count=count+1
n=n//10
print("The number of digits in the number are:",count)
Test Case 1
Input (stdin)2512
Expected OutputThe number of digits in the number are: 4
Test Case 2
Input (stdin)252009
Expected OutputThe number of digits in the number are: 6
No comments:
Post a Comment