#include <stdio.h>
void print_item(int);
int main(int argc,int *argv[])
{
int i,j,k = 0,result;
int n = 1000;
for (i = 1; i < n; i++)
{
result = 0;
for (j = 1; j < i; j++)
{
if (i % j == 0)
{
result += j;
}
}
if (result == i)
{
print_item(i);
}
}
system("pause");
return 0;
}
void print_item(int number)
{
int i;
printf("%d its factors are:",number);
for (i = number; i > 1; i--)
{
if (number % i == 0)
{
if (i == 2)
{
printf("%d",number / i);
}
else
{
printf("%d,",number / i);
}
}
}
printf("\n");
}
|