Well... the debugger would show you the problem pretty quickly, but you should be able to see it yourself with a quick glance over the code.
for (x = 1; x <= c; x++)
{
if(c%x == 0)
{
printf("%d ",x);
sum=0;
sum=sum+x;
printf("%d",sum);
}
Hint: what is the value of
sum
when you try to add the latest value to it?
Moving one line of code will fix it.