Array Calculations | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 1

Array Calculations

can someone explain why the number output is as big as it is. THANKS AS ALWAYS! 🙄 https://code.sololearn.com/cwWMoSlV09Bi/?ref=app

14th Apr 2017, 5:04 PM
Seth T
Seth T - avatar
7 ответов
+ 9
https://code.sololearn.com/c12ja7amjqiE/?ref=app Here it is^ Initialize sum=0;
14th Apr 2017, 5:09 PM
Pixie
Pixie - avatar
+ 8
You can fix it by putting the cout <<sum outside the loop as I have done the code edit
14th Apr 2017, 5:28 PM
Pixie
Pixie - avatar
+ 7
You happen to be my 100th post btw 😃
14th Apr 2017, 5:12 PM
Pixie
Pixie - avatar
+ 2
yea i figured it out before hand im dumb. thanks tho pixie 🙄
14th Apr 2017, 5:09 PM
Seth T
Seth T - avatar
+ 1
and awesome 😂 glad i could be youre 100th post bro/guh, gratz 🙄
14th Apr 2017, 5:27 PM
Seth T
Seth T - avatar
0
ahhh so the last number output is all of the elememts in the array added, the ones output before the last is adding number by number till it reaches the main sum?
14th Apr 2017, 5:25 PM
Seth T
Seth T - avatar
0
ohhhhhhhh awesome thank you for the explanation pixie 😁
14th Apr 2017, 5:28 PM
Seth T
Seth T - avatar