纯C暴力破解,双循环解决

#include<stdio.h>

int main(int argc, char const *argv[])
{
    int n = 0, sum = 0, number = 0;
    while (scanf("%d", &n) != EOF)
    {

        number = 0;
        for (int k = 6; k <= n; k++)
        {
            sum = 0;
            for (int i = 1; i <= k/2; i++)
            {
                if (k%i == 0)
                {
                    sum += i;
                }
            }
            if (sum == k)
            {
                number++;
            }
        }
        printf("%d\n", number);
    }

    return 0;
}