I have this code from my professor and it's about finding abundant and defective numbers. A number x is effective if the sum of all integer divisors, except for x itself, is less than x. If it's greater than x, then it's abundant. There are no compile errors and it seems all fine, but it just doesn't print anything, it doesn't get any result. Why ? What's wrong?
#include <stdio.h>
int main(void)
{
int x=1,y=1;
int sum=0;
while(x<100)
{
while(y<x)
{
if(x%y==0) {
sum=sum+y;
y++;
}
}
x++;
sum=0;
y=1;
}
return 0;
}
If you can help me here, I would be very grateful, thanks in advance.