public class demo1 {
public static void main(String[] args) {
int count = 0, number = 12344;
while(number != 0)
{
// num = num/10
number /= 10;
++count;
}
System.out.println("Number of digits: " + count);
}
}Java
Program to Count Number of Digits using while loop.

Written by
View ProfileNikhil Juneja
Passionate software developer and technical contributor at TutorialsLink.
