0

Hello :)

Suppose I input an int value with Scanner sc = new Scanner(System.in)... and I want to count how many divisors that value has, how would I proceed in "recognizing" a divisor? if ((input/2)%10 == 0)? I'd prefer doing this recursively somehow. Can someone help? :)

Best Wishes!

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Ajantis
0

a is a divisor of b iff (b%a == 0)
I have no idea how (or why) you would do this recursively - you just need a loop to try all values of a from 1 to sqrt(b)

0

Ok, just needed what you said JamesCherrill. :) Thanks for the tips. I solved it now!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.