Question: 1 . Consider the following incomplete method, which is intended to return the number of integers that evenly divide the integer inputVal. Assume that inputVal

1. Consider the following incomplete method, which is intended to return the number of
integers that evenly divide the integer inputVal. Assume that inputVal is greater than 0. public static int numDivisors(int inputVal)
{ int count =0;
for (int k =1; k <= inputVal; k++)
{ if (/* condition */)
{ count++;}}
return count;
}
Which of the following can be used to replace /* condition */ so that numDivisors will work as
intended?
(A) inputVal % k ==0
(B) k % inputVal ==0
(C) inputVal % k !=0
(D) inputVal / k ==0
(E) k / inputVal >0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!