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

 

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

Write a method that returns an array of numbers starting with 'first' and going to 'last' but with all the multiples of 'skip' replaced with a zero. For example, if 'first' is 3, 'last' is 9, and 'skip' is 4, you would return [3,0,5,6,7,0,9] because you counted from 3 to 9 but replaced the two multiples of 4 (4 and 8) with zeros. Pre-conditions: last>=first>0 skip>1 Look at the test data for additional examples.


quiz2023_02_28_APP1SLHL_countSkip(773, 773, 12) → [773]
quiz2023_02_28_APP1SLHL_countSkip(1800, 1800, 2) → [0]
quiz2023_02_28_APP1SLHL_countSkip(1800, 1800, 57) → [1800]

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

public int[] quiz2023_02_28_APP1SLHL_countSkip(int first, int last, int skip) { }

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