Perfect Number In C
问题 I need to write a C program to find the Perfect Number.. main() { int n=1000,sum = 0; for(int num = 1; num <= n; num++) { sum = 0; for(int i = 1; i < num; i++) { if(!(num%i)) { sum+=i; } } if(sum == num) printf("\n%d",num); } } if(!(num%i)) - This is d line I do not understand. If there is any other simple method do please suggest me 回答1: if(!(num%i)) simply means if( (num%i) == 0 ) 回答2: If you are looking for a more efficient way to find perfect numbers, you might want to read the Wikipedia