Horje
divisor summation Code Example
divisor summation
#include<iostream>
using namespace std;

int main() {

		int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;


        int sum = 0;
        for (int i = 1; i * i <= n; i++) {
            if (n%i == 0) {
                sum += i;
                if (i != n/i) {
                    sum += n / i;
                }
            }
        }

        cout << sum - n << endl;
    }

		return 0;

}




Cpp

Related
how togreper Code Example how togreper Code Example
argument to number C++ Code Example argument to number C++ Code Example
DS1302 Code Example DS1302 Code Example
how does header files work in c++ Code Example how does header files work in c++ Code Example
how to create a min priority queue of pair of int, int Code Example how to create a min priority queue of pair of int, int Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11