What's wrong? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What's wrong?

I'm trying to generate random numbers until their sum is equal or higher than 350 https://code.sololearn.com/cionVKnC74BB/?ref=app

25th Oct 2022, 3:17 PM
Iara Lopes
3 Answers
+ 2
sum = m+t ; // overrites old value. instead use sum = sum+ m+t; // add previous value
25th Oct 2022, 3:22 PM
Jayakrishna 🇮🇳
+ 1
In line 28, I think it should be sum += m; And in line 29, you will probably like to increase "count" by 1? What is "t"? It always remains 0?
25th Oct 2022, 3:22 PM
Lisa
Lisa - avatar
+ 1
thank you
25th Oct 2022, 3:25 PM
Iara Lopes