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

30th Oct 2019, 3:48 PM
Phạm Đức
Phạm Đức - avatar
2 odpowiedzi
+ 3
it would be great if you could share your code with us - it makes it much more easy to help.
30th Oct 2019, 4:13 PM
Lothar
Lothar - avatar
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
30th Oct 2019, 4:15 PM
Phạm Đức
Phạm Đức - avatar