我似乎无法弄清楚这一点。我需要计算给定数字以下有多少个数字可以整除。
这是我尝试过的:
public int testing(int x) {
if (x == 0) {
System.out.println("zero");
return x;
}
else if ((x % (x-1)) == 0) {
System.out.println("does this work?");
x--;
}
return testing(x-1);
}
那行不通,我不知道从这里去哪里。有谁知道该怎么做?