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

 

jebbert@volusia.k12.fl.us > test2024_08_29_P1SLHL_digits
prev  |  next  |  chance

Write a method that accepts a non-negative integer 'num', then returns an array containing 10 single-digit integers such that the digits in the array match the digits in 'num'. If 'num' has fewer than 10 digits, the leading digits will be zero in the array. Look at the test data for examples.


test2024_08_29_P1SLHL_digits(8675309) → [0, 0, 0, 8, 6, 7, 5, 3, 0, 9]
test2024_08_29_P1SLHL_digits(5551212) → [0, 0, 0, 5, 5, 5, 1, 2, 1, 2]
test2024_08_29_P1SLHL_digits(0) → [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

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

public int[] test2024_08_29_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: 220

Copyright Nick Parlante 2017 - privacy