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_APP1SLHL_replaceMultiples
prev  |  next  |  chance

Write a method that has parameters 'nums', which is an array of positive integers, and 'mult'. Replace every multiple of 'mult' in 'nums' with a zero and then return that new array. Look at the test data for examples.


quiz2020_12_02_APP1SLHL_replaceMultiples([15, 4, 8, 12, 22, 17, 23], 5) → [0, 4, 8, 12, 22, 17, 23]
quiz2020_12_02_APP1SLHL_replaceMultiples([15, 4, 8, 12, 22, 17, 23], 2) → [15, 0, 0, 0, 0, 17, 23]
quiz2020_12_02_APP1SLHL_replaceMultiples([8, 16, 80, 96, 100, 15], 8) → [0, 0, 0, 0, 100, 15]

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

public int[] quiz2020_12_02_APP1SLHL_replaceMultiples(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: 230

Copyright Nick Parlante 2017 - privacy