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

 

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

Write a method that returns the number of multiple of 'mult' that appear in the 'nums' array. As preconditions, you may assume that 'mult' is positive and that all the elements of 'nums' are positive. Note that 'nums' could be empty, in which case you would return 0. Look at the test data for examples. Note that every integer is a multiple of 1, so if 'mult' is 1, you will return the length of the array because every element in the array will be a multiple of 1.


quiz2023_04_25_APP1SLHL_countMults([42, 325, 346, 57, 876, 2335, 756, 235, 85, 21253, 643, 677, 25345, 745, 35223, 683, 235, 8776, 345, 892, 3525, 9823], 1) → 22
quiz2023_04_25_APP1SLHL_countMults([17, 12, 18, 22, 19, 23, 50], 2) → 4
quiz2023_04_25_APP1SLHL_countMults([14, 28, 7, 77], 7) → 4

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

public int quiz2023_04_25_APP1SLHL_countMults(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