First, you have an infinite loop in your program.

trace the value of n, first it is 1, then the while loop sets it to zero again and then adds 1 to in the for loop

Second, you never reset your accumulator to zero.

Third, your check is comparing n, which is zero, to your sum, which can never be zero because 0! = 1.

try this:

for( num = 1; num <= limit; num++)

{

n = num;

sum = 0;

// your while loop

if( num == sum )

printf( "%d is a strong number\n", num );

}