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

 

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

Write a method that returns only the multiples of 'mult' that appear in the array 'nums'. They should appear in the same order as in the original array 'nums'. The new array will be the same length as 'nums' with the end of the array padded in zeros. Look at the test data for examples.


quiz2020_12_02_P1SLHL_selectMults([87, 43, 91], 2) → [0, 0, 0]
quiz2020_12_02_P1SLHL_selectMults([46, 22, 12, 66, 120], 2) → [46, 22, 12, 66, 120]
quiz2020_12_02_P1SLHL_selectMults([5, 6, 10, 21, 22, 25, 27, 85, 42, 40], 5) → [5, 10, 25, 85, 40, 0, 0, 0, 0, 0]

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

public int[] quiz2020_12_02_P1SLHL_selectMults(int[] nums, int mult) { }

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: 270

Copyright Nick Parlante 2017 - privacy