Untitled

 avatar
nhatlenguyen
plain_text
a month ago
500 B
1
Indexable
Never
class Test {
	public static void sumDivision(int n) {
		int sum = 0;
		for (int i = 1; i <= n/2; i++) {
			if( n % i == 0 ) sum+= i;
		}
		System.out.println(sum);
	}

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int numTest = scanner.nextInt();
		int[] n = new int[numTest];
		for (int i = 0; i < numTest; i++) {
			n[i] = scanner.nextInt();

		}
		for (int i = 0; i < numTest; i++) {
			sumDivision(n[i]);
		}
		scanner.close();
	}
}
Leave a Comment