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

 

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

Create a function that takes two numbers as arguments 'num' and 'length' and returns an array of multiples of 'num' until the array length reaches 'length'. For example, if 'num' is 3 and 'length' is 5, you would return {3,6,9,12,15} because those are the first 5 multiples of 3. Look at the test data for more examples. Note: As preconditions you may assume that both 'num' and 'length' are positive.


quiz2021_11_16_APSLHL_mults(3, 5) → [3, 6, 9, 12, 15]
quiz2021_11_16_APSLHL_mults(2, 10) → [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
quiz2021_11_16_APSLHL_mults(1, 2) → [1, 2]

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

public int[] quiz2021_11_16_APSLHL_mults(int num, int length) { }

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