Write a program using Scanner class...Enter a number and check whether it one-digit number,two-digit number,three-digit number or more than three digit number
please help me out
Answers
Answered by
1
Answer:
scanner sc = new scanner (System.in);
int x = sc.nextInt();
int c= 0
while (x!= 0)
{
int d= x%10;
c++
x=x/10;
}
switch c
{
case 1:
sop (" one digit");
break;
case 2:
sop("two digit");
break;
case 3:
sop (" three digit");
break;
default
sop("more than 3 digit");
}}}
Similar questions