Professor says this isn't a efficient algorithm to check whether the number is divisible by a number from 100,000-150,000. I'm having trouble finding a better way. Any help would be appreciated.
unsigned short divisibility_check(unsigned long n){
unsigned long i;
for(i=100000; i<=150000;i++){
if(n%i == 0){
return 0;
}
}
return 1;
}
转载于:https://stackoverflow.com/questions/53111230/efficient-way-to-find-divisibility