# Thread: Need some ideas on gerating divisors.

1. ## Need some ideas on gerating divisors.

Recently we got an group assignment in our class. This is totally different than what we have been done is class so far. We have no idea how to start this this off. Assignment is
"Write a program that reads two integers and prints the number in the given range that has the most divisors, as well as its number of divisors.
Example:
Enter two integers: 20 100
60 with 10 divisors has the largest number of divisors."

This is a beginning class. so far we have learned up to loops and now doing functions. Any help will be appreciated. Thaks 2. So, you know something is a divisor of something else if the modulo is 0. You also don't need to go past n /2 numbers to determine this (this part I'm unsure of lol). So basically, for each number, just use a dumb for-loop and then iterate and if the modulo of your target number with the index of the loop is 0, then it's a divisor.

Por ejemplo with numero 60:
Code:
```int const num{ 60 };

for (int i = 2; i < num; ++i) {
if (num % i == 0) {
std::cout << i << " is a divisor\n";
}
}``` Popular pages Recent additions assignment, class, divisors, integers, number 