+ 1
What should I do in this code?
What is my mistake? https://code.sololearn.com/cB66JDQLN95Z/?ref=app
2 Answers
+ 4
Just add;
i=1;
after
res=0;
then the code will work as intended, at least for the first 4 perfect numbers, since the playground will timeout before your loop can reach the next one.
+ 4
It would help to reset res and i each time through the outer loop.