+ 1

Why the checker part of my program works but the list part doesn't?

https://code.sololearn.com/c8pB8Vgw6s0e/?ref=app

25th Mar 2018, 3:16 PM
Ayush Mathur
Ayush Mathur - avatar
3 odpowiedzi
+ 2
change for (int j=1;j<=z;j++) to for (int j=1;j<z;j++) you are going past last value stored in current loop getting whatever was left over before.
26th Mar 2018, 12:50 AM
John Wells
John Wells - avatar
+ 1
More than likely, it is because your input of x in main doesn't get passed into list so your code isn't solving the correct problem.
25th Mar 2018, 6:46 PM
John Wells
John Wells - avatar
0
sorry John Wells sir, But I don't intend to have an input in my list part. because it has to check each and every natural number. if it is perfect, it gets displayed. if it is not perfect, it doesn't get displayed. The output of my list is : 1 6 525 ... which is wrong. the correct output should be 1 6 28 496...
26th Mar 2018, 12:19 AM
Ayush Mathur
Ayush Mathur - avatar