递归法:
#include<stdio.h>
int fun(int x)
{
int sum = 0;
if (x == 1 || x == 2)
return 1;
for (int i = 2; i <= x; i++)
{
if (x%i == 0)
sum += fun(x/i);
else
continue;
}
return sum;
}
int main()
{
int sum;
sum=fun(12);
printf("%d", sum);
return 0;
}