0

It doesn't work properly. Please what is wrong!

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

14th Aug 2021, 7:05 PM
TeaserCode
5 Answers
+ 2
You change n in the 2nd while loop too. So n = 0 in the end and n != sum
14th Aug 2021, 7:22 PM
Lisa
Lisa - avatar
+ 1
You change the value of n in line 12 and then after resetting it in li e 16, you change it a again line 22.
15th Aug 2021, 6:01 AM
Lisa
Lisa - avatar
+ 1
Lisa thanks for help.
15th Aug 2021, 6:52 AM
TeaserCode
+ 1
You could add another variable in the top in which you keep num = 153 and then reassign n = num if needed an compare num == sum i the end
15th Aug 2021, 7:04 AM
Lisa
Lisa - avatar
0
Another question, why do I have to write n=153 once again before second while loop. If I do that at the beginning when I declare and inicialise it?
15th Aug 2021, 2:56 AM
TeaserCode