Write a program to find the number of digit in java

 Write a program to find the number of digit in java 

public class NumberOfDigit
{
    public static void main(String args[]){
     int number=125,digit=0;
     while(number!=0){
        digit++;
        number=number/10;
        }
     System.out.println(digit+" digit Number");
    }
}

Output
3 digit Number

Comments

Popular posts from this blog

Calculate Compound Interest in JavaScript

How to make simple bill maker by using python tkinter

Admin Login Page Using HTML and CSS