diff --git a/Code.html b/Code.html new file mode 100644 index 0000000..a0583ee --- /dev/null +++ b/Code.html @@ -0,0 +1,83 @@ + + +
+
+
+
+ // Python program to count the digits in a number
+ def count_digits(n):
+ n = str(n)
+ return len(n)
+
+
+ # Driver code
+ n = 456533457776
+ print(count_digits(n))
+
+
+
+ + Input : 12345 + Output: Total No Of Words: 5 ++ + + +
+ Input : 5342 + Output: Total No Of Words: 4 ++ + + +
+ Input : 42345221 + Output: Total No Of Words: 8 ++ +
The above program iterates n log10(n) times
So time complexity is O(log10(n))
+