From 9dba4c40a2d1a0213fa2a94a390b09cb1cdd1832 Mon Sep 17 00:00:00 2001 From: Ajinkya Sharma Date: Fri, 2 Oct 2020 13:52:53 +0530 Subject: [PATCH] Create Code to count the digits --- Code to count the digits | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Code to count the digits diff --git a/Code to count the digits b/Code to count the digits new file mode 100644 index 0000000..db25927 --- /dev/null +++ b/Code to count the digits @@ -0,0 +1,10 @@ +import math + +def countDigit(n): + return math.floor(math.log(n, 10)+1) + +# Driver Code +n = 345289467 +# if want user input +# n = int(input()) +print ("Number of digits : % d"%(countDigit(n)))