We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d2870c8 commit e683343Copy full SHA for e683343
Maths/CountDigit.java
@@ -0,0 +1,13 @@
1
+import java.util.*;
2
+import java.lang.*;
3
+// count the number of digits in a number
4
+class CountDigit{
5
+ public static void main(String args[]){
6
+ Scanner sc = new Scanner(System.in);
7
+ System.out.print("Enter the number: ");
8
+ int number = sc.nextInt();
9
+ int digits = 0;
10
+ digits = (int)Math.floor(Math.log10(number) + 1);
11
+ System.out.println("The number of digits present in the number: " + digits);
12
+ }
13
+}
0 commit comments