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

 

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

Write a method that returns the number of elements in the integer array 'nums' that are multiples of 'mult'. For example, in the array {3,12,17,33,5,1,9} there are 4 elements that are multiples of 3. So, for that array, if 'mult' was 3, you would return 4. As a precondition, you may assume that 'mult' is greater than or equal to 1. Note that all numbers are considered multiples of 1.


practice2023_10_20_countMults([-8, -200, -40, -6], 2) → 4
practice2023_10_20_countMults([5, 10, 15, 20, 25, 30, 35, 40], 5) → 8
practice2023_10_20_countMults([5, 10, 15, 20, 25, 30, 35, 40], 10) → 4

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

public int practice2023_10_20_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: 220

Copyright Nick Parlante 2017 - privacy