Finding Number of Digits in a Number
The following Java program finds the number of digits in a number. This program converts the number to a string and then prints its length, public class DigitsInNumber { public static void main(String[] args ) { int number = 94487; String s = String.valueOf(number); System.out.println(number + " has "+ s.length()+" digits"); } } The following […]