Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int number_of_divisors(int x){
- int i, count = 0;
- for (i = 1; i*i < x; i++){
- if (x%i == 0)
- count += 2;
- }
- if (i*i == x)
- count++;
- return count;
- }
- int main()
- {
- int a, b, n;
- cout << "n=";
- cin >> n;
- cout << "a=";
- cin >> a;
- cout << "b=";
- cin >> b;
- int cnt = 0;
- for (int i = a; i <= b; i++)
- if (n==number_of_divisors(i))
- {
- cout << i << " " << number_of_divisors(i) << endl;
- cnt++;
- }
- if(cnt == 0)
- cout << "No divisors" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment