0
My code can't find the 5th perfect numbers
It's only found the 4th perfect number and my code did't run anymore
2 ответов
+ 3
it would be great if you could share your code with us - it makes it much more easy to help.
0
#include <iostream>
using namespace std;
int main() {
long long int n,x,sum;
for (n=1;n<=100000000;n++){
sum=0;
for(x=1;x<n;x++){
if(n%x==0){sum+=x;}
}if(sum==n) {cout<<n<<endl;}
}
return 0;
}
Here man