package test;
import java.util.Scanner;
import static java.lang.System.out;
public class TestClass {
public static int numOfFactors(int n, int s, int e) {
int factors = 0;
for(int i = s; i<=e; i++) {
while(n%s==0) {
factors = factors + 1;
}
}
return factors;
}
public static void main(String[] args) {
TestClass test = new TestClass();
System.out.println(test.numOfFactors(100,10,30));
}
}
这是我的程式码,想在s,e区间中找到n的因子个数。但在使用Eclipse编译的过程中,
run完都没有结果产生(印出简单的Hello World是成功的)。自己觉得是使用method的方法有误,但在找完网络上的资料试过,
都不太清楚是什么地方有误,想请问大大们@@