Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(final String[] args) {
- try (Scanner scan = new Scanner(System.in)) {
- int n=scan.nextInt();
- final int[] a = new int[(int) Math.floor(Math.log10(n) + 1)];
- int rem;
- int i=0;
- while(n!=0)
- {
- rem=(n%10);
- a[a.length - i - 1] = rem;
- n = n/10;
- i++;
- }
- System.out.println(Arrays.toString(a));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement