id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jan30_2020_P1SLHL_digits


Write a method that accepts a non-negative integer called 'num'. Return an array of 10 integers such that each element in the array represents a single digit of 'num' with the least-significant digit at the end of the array. The array will always have exactly 10 digits, so leading digits will be zero. Also, as a precondition, you may assume that 'num' will be non-negative and will have no more than 10 digits.


jan30_2020_P1SLHL_digits(1234567890) → [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
jan30_2020_P1SLHL_digits(10004203) → [0, 0, 1, 0, 0, 0, 4, 2, 0, 3]
jan30_2020_P1SLHL_digits(895312) → [0, 0, 0, 0, 8, 9, 5, 3, 1, 2]

...Save, Compile, Run (ctrl-enter)

public int[] jan30_2020_P1SLHL_digits(int num) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 290

Copyright Nick Parlante 2017 - privacy