w tab CS200-1-HW6 (2).pdf | ? cs-200-FinalExarm-Spnn × + ? cs-200 FinalExam Spri
ID: 3917846 • Letter: W
Question
w tab CS200-1-HW6 (2).pdf | ? cs-200-FinalExarm-Spnn × + ? cs-200 FinalExam Spring2018.pdf Problem 2 Write a Java method countMultiplesofN that accepts an integer array named arr as well as one integer parameter named n. The method returns the number of elements in arr that are a multiple of n. Here are some sample calls with return values: a1 10 9 18 62 20 33 5 countMultiplesofN(a1, 5) returns 3 a2 17 13 49 10 22 60 3 countMultiplesofN(a2, 20) returns 2 a3 12371 51-8·8.178192151] countMultiplesOfN(a3, 11) returns e public static int countMultiplesofN (int (1 arr, int n) fExplanation / Answer
public static int countMultiplesOfN(int[] arr, int n) { int count = 0; for(int i = 0; iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.