0
Find perfect number smaller than n
Hi everyone, I tried to write a program, that returns the perfect numbers smaller than n. For example, if n is 10, the program should return "6". This is my code: https://code.sololearn.com/ca2A1A0A21a1 My problem with my code is that it returns only 1 number lower than n e.g. 9 if n=10 and so on. If I "return sum" - I get 240 if n = 10. I don't get it... Apprreciate any help!
9 Respuestas
0
looks really good, but is it possible to write a code without an Array?
0
Alright, thanks a lot Abol! Appreciate your time to help me :)
0
Abol, I have another question 🙄
Can you show me how to print any perfect number, instead of add (i) to a list?
just tried to do it, and it doesn't seem to work. It just prints out the number from 1 - (n-1)....
I just updated my code, so you can see what I've changed: https://code.sololearn.com/ca2A1A0A21a1