Check out example codes for "c++ find number of divisors". It will help you in understanding the concepts better.

Code Example 1

// https://www.geeksforgeeks.org/count-divisors-n-on13/
int countDivisors(int n) { 
    int cnt = 0; 
    for (int i = 1; i <= sqrt(n); i++) { 
        if (n % i == 0) { 
            // If divisors are equal, 
            // count only one 
            if (n / i == i) 
                cnt++; 
  
            else // Otherwise count both 
                cnt = cnt + 2; 
        } 
    } 
    return cnt; 
}

Learn ReactJs, React Native from akashmittal.com