write a java program to find the total number of digits in a given number(input by user)
plz answer it fast!!
Answers
Answered by
4
Explanation:
import java.util.*;
class Digit_count
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in());
System.out.println("enter a number");
int n=sc.nextInt();
int c=0;
while(n>0)
{
n/=10;
c++;
}
System.out.println("no of digits are"+c);
}
}
Similar questions