Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
adit242 authored Oct 11, 2021
1 parent 7fc71d4 commit d84f782
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions Code.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<!DOCTYPE html>
<html>
<head>
<title>Code page</title>
<style>
h2,h3,h4,section {
padding:0px 15%;
}
code,pre {
margin-left: 15%;
}
p{
text-align: center;
}
*{
text-align: center;
font-size: 30px;
}
</style>
</head>
<body>
<header style="text-align: center">
<h1>Welcome to Coding Page..</h1>
</header>
<hr>
<h2>Counts the digits in a number..</h2>
<section>
<h3 style="text-align: center">Python code for given problem statement</h3>
<code>
<pre style="border: 2px solid; align-self: center;">

// 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))

</pre>
</code>
</section>
<section>
<h3>Sample Inputs and Outputs...</h3>
<samp>
<pre>
Input : 12345
Output: Total No Of Words: 5
</pre>
</samp>

<samp>
<pre>
Input : 5342
Output: Total No Of Words: 4
</pre>
</samp>

<samp>
<pre>
Input : 42345221
Output: Total No Of Words: 8
</pre>
</samp>
</section>
<section>
<h3>Variables use in a program : <var>n , cnt</var></h3>
</section>
<section>
<h3>Complexity</h3>
<p>The above program iterates <s>n</s></sup> <strong> log<sub>10</sub>(n)</strong> times</p>
<p>So time complexity is <strong>O(log<sub>10</sub>(n))</strong></p>
</section>
<hr>
<footer>
<p>For more information
<a href="https://www.geeksforgeeks.org/program-count-digits-integer-3-different-methods/" target="_blank">Click here</a></p>
<p>Or visit <a href="https://www.geeksforgeeks.org/" target="_blank">GeeksForGeeks</a></p>
</footer>
</body>
</html>

0 comments on commit d84f782

Please sign in to comment.