From f2b50c0e6c06ceadd26ff96e1e2e29f94d085bf8 Mon Sep 17 00:00:00 2001 From: shellhub Date: Sun, 16 Aug 2020 11:55:25 +0800 Subject: [PATCH] duplicate with NumberOfDigits.java --- Maths/CountDigit.java | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 Maths/CountDigit.java diff --git a/Maths/CountDigit.java b/Maths/CountDigit.java deleted file mode 100644 index 0f1852a3..00000000 --- a/Maths/CountDigit.java +++ /dev/null @@ -1,21 +0,0 @@ -package Maths; - -import java.util.*; - -// count the number of digits in a number -public class CountDigit { - public static void main(String args[]) { - Scanner sc = new Scanner(System.in); - System.out.print("Enter the number: "); - int number = sc.nextInt(); - int digits = 0; - if(number == 0){ - System.out.println("The number of digits present in the number: 1"); - } - else - { - digits = (int)Math.floor(Math.log10(Math.abs(number)) + 1); - System.out.println("The number of digits present in the number: " + digits); - } - } -}