write a program to input a number and display its digits and the number of its digits. using digit seperation.
Answers
Answered by
2
Answer:
import java.util.*;
class Digit
{
void main()
{
int n=sc.nextInt(),c=0,r;
System.out.println("The digits are : );
for(inti=n;i!=0;i++)
{
r=i%10;
i/=10;
System.out.println(r);
c++;
}
System.out.println("The number of digits = "+c);
}
}
Similar questions